shell-script headers (#!/bin/sh vs #!/bin/csh)
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Why do all script files start with #!/bin/sh or with #!/bin/csh Is that required? What's the purpose of this? And what's the difference between the two? 回答1: This is known as a Shebang : http://en.wikipedia.org/wiki/Shebang_(Unix) #!interpreter [optional-arg] A shebang is only relevant when a script has the execute permission (e.g. chmod u+x script.sh). When a shell executes the script it will use the specified interpreter. Example: #!/bin/bash # file: foo.sh echo 1 $ chmod u+x foo.sh $ ./foo.sh 1 回答2: The #! line tells the kernel