On Mon, Apr 02, 2012 at 08:46:12PM +0200, Lluís Batlle i Rossell wrote:
> #!/bin/sh
You're running this in sh?  But reporting it as a bug in bash?

> PIPE=/tmp/pipe
> 
> rm -f $PIPE
> mkfifo $PIPE
> set -x
> 
> spawn() {
>     sleep 0.1
>     echo DONE > $PIPE
> }
> 
> spawn &
> 
> while true; do
>     while read LINE < $PIPE; do
>         echo $LINE
>         spawn &
>     done
> done

I ran this, with #!/bin/bash and with sleep 1 instead of sleep 0.1,
on an HP-UX 10.20 system and a Debian 6.0 (Linux) system.  For me,
it printed "DONE" once per second until I pressed ctrl-C, on both
systems.

Changing the sleep 1 back to sleep 0.1 and re-running on the Linux
system produced the same result, just 10 times as fast.

Changing the #!/bin/bash to #!/bin/sh and re-re-running on Linux
still produced the same result.

Reply via email to