automatically acknowledge commands

Chris F.A. Johnson cfaj-uVmiyxGBW52XDw4h08c5KA at public.gmane.org
Wed Jun 21 19:50:47 UTC 2006


On Wed, 21 Jun 2006, David Thornton wrote:

> Chris F.A. Johnson wrote:
>>  On Thu, 15 Jun 2006, Neil Watson wrote:
>> 
>> >  Since Ken missed out on the last one here's another.  I have script that
>> >  annoyingly requires a 'y' prompt part way through.  Alas, the script is
>> >  not mine and may change in the future.  How can I automate the 'y'
>> >  answer?
>>
>>  echo y | /path/to/script
>>
>>  yes | /path/to/script
>
> "expect" might do the job.
>
> It's a "scripting" language designed to run against interactive sessions.

     If the script reads from stdin, expect is overkill, and the pipe
     will do the job. Expect's main use is for commands that read
     directly from the terminal (/dev/tty).

     Besides, if it's a scipt, it presumably can be changed, either so
     that it does read from stdin, or else doesn't ask at all.

-- 
    Chris F.A. Johnson                      <http://cfaj.freeshell.org>
    ===================================================================
    Author:
    Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list