Re: bash script to answer a prompt



On 21 Apr 2006 04:41:16 -0700, rupert@xxxxxxxxxxxxxxxx wrote:
I'm new to bash scripting and i'm struggling to express the correct
search on google. Does anybody know what it is called when you actually
answer a prompt with the script? eg
cd ~/aProgramDirectory # goes into the directory I want..
someCommand # runs the program, it starts and asks;

do you want to do this?[y/n] ; # I need to type yes here...

Depends on where the program is expecting input. Try

#************ start of script **************

_orig_dir=$PWD

cd ~/aProgramDirectory
program_you_want_2_run_here
y

#then on completion of the job I want to...

cd $_orig_dir

#then does other stuff....

#************ end of script **************


Some light reading found here
! bash script advanced documentation
http://tldp.org/LDP/abs/html/index.html
! bash script introduction to Linux documentation
http://tldp.org/LDP/intro-linux/html/index.html

the problem is the programs stops running when it get's to a prompt
any ideas?

You may have to use expect

.



Relevant Pages