我试图理解为什么脚本可以使用#!/bin/bash但不是#!/bin/sh.我运行Cygwin和都sh.exe和bash.exe似乎是相同的(相同的文件大小).
$ cat 1.sh
#!/bin/sh
while read line; do
echo ${line:0:9}
done < <(help | head -5)
$ ./1.sh
./1.sh: line 4: syntax error near unexpected token `<'
./1.sh: line 4: `done < <(help | head -5)'
$ cat 2.sh
#!/bin/bash
while read line; do
echo ${line:0:9}
done < <(help | head -5)
$ ./2.sh
GNU bash,
These she
Type `hel
Use `info
Use `man
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2780 次 |
| 最近记录: |