#!/bin/sh vs #!/bin/bash filename expansion after <
Eliot Moss
moss@cs.umass.edu
Wed Aug 12 20:53:52 GMT 2020
On 8/12/2020 4:07 PM, Andrey Repin wrote:
> Greetings, Morten Kjærulff!
>
>> This script:
>
>> #!/bin/sh
>> echo hello >hello.txt
>> ls -l
>> cat hell*
>> cat < hell*
>
>> gives me:
>
>> $ ./t.sh
>> total 2
>> -rw-r--r-- 1 vp01mkf Domain Users 6 Aug 12 19:51 hello.txt
>> -rwxr-xr-x 1 vp01mkf Domain Users 60 Aug 12 19:51 t.sh
>> hello
>> ./t.sh: line 5: hell*: No such file or directory
>
>> But if I change line1 to
>> #!/bin/bash
>> I get
>> hello
>> hello
>
>> Is that correct behaviour. I guess so, but why? And what is the rule?
>
> d2u t.sh
> ???
Yes, you need to watch line endings under cygwin! The usual Windows CR-LF
can cause a world of grief. You can mount drives to hide this, but doing
so can mess up reading binary files ...
EM
More information about the Cygwin
mailing list