Re: bash - pipe



Trying to reproduce your example:

ldo@theon:~> echo 123 >/tmp/fifo & echo 456 >/tmp/fifo &
[1] 25800
[2] 25801
ldo@theon:~> read -n3 </tmp/fifo; echo $REPLY
123
bash: echo: write error: Broken pipe
ldo@theon:~>
[1]- Done echo 123 > /tmp/fifo
[2]+ Exit 1 echo 456 > /tmp/fifo

The second echo died as soon as the input end of the pipe was closed.


??

I have no errors... and $REPLY is 456


$ uname -r
2.6.24.3vnl

$ echo $BASH_VERSION
3.1.17(1)-release

-----------------

$ echo 123 > /tmp/fifo & echo 456 > /tmp/fifo &
[1] 11408
[2] 11409

$ read -n3 < /tmp/fifo ; echo $REPLY
456
[1]- Done echo 123 >/tmp/fifo
[2]+ Done echo 456 >/tmp/fifo

-----------------


what happens?
.



Relevant Pages

  • Re: Problems with FreeBSD 6.0
    ... since no version of FreeBSD reports itself as LINUX ... Unless uname is a Linux binary. ... getting bash instead of sh - because /bin/sh on Linux is bash. ... SysV and BSD echo commands have different behaviors. ...
    (freebsd-hackers)
  • Re: bash - pipe
    ... In message, Antonio Macchi ... bash: echo: write error: Broken pipe ... The second echo died as soon as the input end of the pipe was closed. ...
    (alt.os.linux)
  • Re: PATH variable
    ... Floyd L. Davidson wrote: ... >>which should result in echo $PATH ... configuration files before bash invokes /etc/profile ... > come to a single line in a single file that in fact does modify ...
    (comp.os.linux.misc)
  • Re: Bash script - telnet
    ... > I need a telnet script in bash. ... (echo user your_username ... Notice that "echo" preceeds the commands to the remote server. ...
    (comp.unix.questions)
  • Re: Probably very stupid script/bash question
    ... both solutions work perfectly under bash. ... echo "Data received = $E Bytes" ... If the first line has white space, then as many variables as there are "fields" in the line will contain values. ... you must have one or more white spaces between the two 'less than' symbols and NO space between the 'less than' and the 'left parenthesis'. ...
    (Debian-User)