Bash: not absolute script #! interpreter?
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
精彩评论