Web lists-archives.com

Re: Bash heredoc on FD 3




On 12/4/2018 7:13 AM, Houder wrote:
On Sun, 02 Dec 2018 10:43:17, Steven Penny  wrote:
Using this file:

     $ cat hello.sh
     awk -f /dev/fd/3 3<<eof
     BEGIN {
       print "hello world"
     }
     eof

it runs as expected with Dash:

     $ dash hello.sh
     hello world

However it fails with Bash:

     $ bash hello.sh
     awk: fatal: can't open source file `/dev/fd/3' for reading (No such file or
     directory)

I tried also with Debian and both Dash and Bash work as expected. What is
causing Cygwin Bash to fail here?

File to which symlnk /dev/fd/3 refers has "gone"; different from Linux, where
the file is "deleted", but still "available".
(note: dash uses a different implementation)

Dash is faster in processing the data but can be made to fail if you add -d to the ls commands you're using.

--
cyg Simple

--
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