[CentOS] [OT] bash here documents

Mon Jun 24 18:14:27 UTC 2013
Les Mikesell <lesmikesell at gmail.com>

On Mon, Jun 24, 2013 at 12:36 PM, Steve <zephod at cfl.rr.com> wrote:
> My junk program is a quick-and-dirty simulation if the actual program I am trying to use.
> I do not have the code for the program and all I know is that it responds to command input and the only way to terminate it is with <ctrl-C>.

It is somewhat hard to believe that the 'real' program would not exit
when it hits the end-of-file, which you would simulate with <ctrl-D>
at the terminal and the end of a here document will also provide.
What happens if you run the real program with input redirected from a
file - does the machine melt as it keeps on reading?

> If I run my junk program directly, I get:
> $ ./junk
> blah
> response to blah
> bleh
> response to bleh
> ^C
> $
> I want to be able to get the same output from the script AND have the script end and not hang waiting for more input.

Are you sure it won't end with a typed ^D as the only thing typed?
If it really needs the ^C you'll have to do something ugly to kill it
with a signal.

   Les Mikesell
     lesmikesell at gmail.com