in reply to Re^3: Send Bash Command
in thread Send Bash Command

But still the script is hanging.

I think its waiting for input, not hanging.

Replies are listed 'Best First'.
Re^5: Send Bash Command
by Anonymous Monk on Mar 03, 2010 at 02:35 UTC
    What do you mean waiting for an input? Did it spawn a shell prompt?

      Yes.

      By the way, $|=1; won't affect IN, just the currently selected handle (STDOUT). The easiest way to turn on autoflushing for another handle is

      use IO::Handle; IN->autoflush(1);

      But what about buffering in the other direction. Unfortunately, you can't really control any buffering the child might do to its output. If you need interactivity, you should have better luck with Expect since it uses ptys to communicate with the child, and that usually causes the child to avoid buffering.

      bash is a shell, so when you launch bash, you get shell prompt