开发者

Bash: not absolute script #! interpreter?

开发者 https://www.devze.com 2023-01-17 15:51 出处:网络
Is it possible to开发者_运维百科 say to a script to search for an interpreter not in an absolute location, but in his path?

Is it possible to开发者_运维百科 say to a script to search for an interpreter not in an absolute location, but in his path?

For example, writing #!/usr/bin/php will fail if the user has php installed somewhere else.

Just writing #!php does not automatically work, of course, and I couldn't find anything about it, they just all treat this method as if it was "the way"® to do it.

So, is there a standard simple syntax to say "search for it anywhere in your path"?


Try:

#!/usr/bin/env php
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号