Web lists-archives.com

Re: grep < fifo fails




Am 03.10.2018 um 17:37 schrieb Ole Tange:
This works:

$ mkfifo fifo
$ echo > fifo & grep .  fifo
[1] 10232
[1]+  Done                    echo > fifo

But this fails:

$ echo > fifo & grep . < fifo
[1] 11756
grep: (standard input): Invalid argument
[1]+  Done                    echo > fifo

I see the same behavior on MINGW, but I do not see the same behavior on GNU/Linux.


Regards,

Ole Tange

I assume it is a consequence of the same problem on files.
You can not use the same source for input and output.

$ echo "prova" > prova.txt

$ cat prova.txt
prova

$ cat prova.txt > prova.txt

$ cat prova.txt

the file was erased



---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple