Why sh failed 'Process Substitution'?

Dave Korn dave.korn.cygwin@googlemail.com
Tue Jun 9 21:18:00 GMT 2009


Daniel B. wrote:
> Dave Korn wrote:
>> Pan ruochen wrote:
>>> Hi All,
>>> Why sh failed to recognize Process Substitution, even if /bin/sh.exe
>>> is a copy of /bin/bash.exe?
>>> $cat test.sh
>>> #!/bin/bash
>>> A="A"
>>> B="B"
>>> diff <(echo $A) <(echo $B)
>>> $sh test.sh
>>> a.sh: line 4: syntax error near unexpected token `('
>>> a.sh: line 4: `diff <(echo $A) <(echo $B)'
>>
>>   See the section "6.11 Bash POSIX Mode" in the bash info page, item 22:
>>
>>> " 22. Process substitution is not available. "
> 
> Pan,
> 
> What Dave didn't point out is that it's because you're running your
> script using "sh test.sh" instead of using "test.sh" (or ./test.sh or
> whatever, depending your execution search path setting (PATH)) (or even
> using "bash test.sh").

  See the section "6.11 Bash POSIX Mode" in the bash info page, second para.
from the top:

>"   When invoked as `sh', Bash enters POSIX mode after reading the
>  startup files.  "

    cheers,
      DaveK

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



More information about the Cygwin mailing list