On 9/23/11 9:01 AM, "Edward Capriolo" <[email protected]> wrote:

>On Fri, Sep 23, 2011 at 11:52 AM, <[email protected]> wrote:
>
>> Hi Harsh,
>>
>> On 9/22/11 8:48 PM, "Harsh J" <[email protected]> wrote:
>>
>> >Ivan,
>> >
>> >Writing your own program was overkill.
>> >
>> >The 'yes' coreutil is pretty silly, but nifty at the same time. It
>> >accepts an argument, which it would repeat infinitely.
>> >
>> >So:
>> >
>> >$ yes Y | hadoop namenode -format
>> >
>> >Would do it for you.
>>
>> Nice!  I read the man page for yes too quickly and did not see that
>> option.  Thanks!
>>
>>...... SNIP ...............
>>
>You might want to try expect scripting. You open a stream to the process
>and
>then can wait for prompts and print replies. expect also has this feature
>autoexpect which is a shell that records the streams and turns your
>teminal
>interaction into an expect script.

Yeah, I have used expect via a python library numerous times, but expect
is a bit brittle and error prone, so I try to avoid it whenever possible.

Cheers,
Ivan

Reply via email to