Re: Bash Scripting Question
Hi
On Sun, Nov 03, 2013 at 02:35:30PM -0500, Thomas H. George wrote:
> The script I am trying to write executes a program that requires a
> keyboard response. I have experimented with redirecting STDIN but haven't found the
> correct way to make the response. I found one example that scanned the
> response from apt-get install xxxx for the letter y and fed this back to
> install xxxx. In my case I must respond with a word in answer to the
> programs question.
Well - if you're trying to script a command, have a closer look at the
man-page for the command in question: There may be ways of making the
command non-interactive: Then you don't have to give it any input at
all!
If you are trying to script the "apt-get install" command, check out
the "--yes" option and it's relatives.
Note that apt WILL ask if you're trying to do "crazy" stuff, e.g. like
removing essential packages. Even the simpler questions are there to
give you a chance not to shoot yourself in the foot: If you script the
answers to them, your (metaphorical) foot is in danger...
> I'm sure this must be elementary but I have read large sections of
> BASH GUIDE FOR BEGINNERS and AVANCED BASH-SCRIPTING GUIDE without
> finding a solution. I would appreciate a little help or advice.
:-) Good - that's definitely worth reading.
--
Karl E. Jorgensen
Reply to: