Because interpreters such as zsh, bash, python, perl may be located in different places on the filesystem, scripts often have a shebang that uses env
for portability, e.g. #!/usr/bin/env zsh
. However, as http://en.wikipedia.org/wiki/Shebang_(Unix)#Portability explains, many systems including Linux don't allow the passing of arguments to the interpreter.
Often, I'd like to do something like #!/usr/bin/env zsh -f
to prevent my script to ever read my ~/.zshenv
, or I'd like to do #!/usr/bin/env perl -w
, etc. This works on OS X, but not on Linux.
What is the workaround for that? Can I have the best of both worlds: portability and arguments for the interpreter? If possible, give a general workaround that works for all interpreters, not just zsh.