Andrew Lentvorski wrote: > James G. Sack (jim) wrote: > >> Nowadays, I tend to just use >> #!/usr/bin/python >> >> ..but perhaps others can comment on their preferences. > > Sigh. All the world is Linux...not! > > Congratulations. Your script just failed on Solaris, Cygwin, FreeBSD, etc. > > Don't do that. The whole point of: > > #!/usr/bin/env python > > Is that /usr/bin/env is almost *always* in that specific place for a > *nix system. Python often is not. In addition, sometimes you need to > run different versions of Python for different users, and you just > blocked any ability to do that. > > In addition, using env allows people to install Python in non-standard > places and to still use your scripts without modification. > > In short, hard coding the path is bad. Even hard coding env is annoying > but is the least bad option. >
I just knew you'd post a reminder of that (thanks).. I believe a previous discussion made additional points that I might paraphrase as: 1) if you wish a script to be useful in a variety of environments.. use #!/usr/bin/env prog 2) but if a script is (say) o+x and (eg, for security) you wish the script NOT to execute anything other than the known program at the known absolute path, then you probably should hard code the path appropriate for that host. regards, ..j -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list
