Last Updated: February 25, 2016
·
531
· scott2b

Make your shebangs portable #!

When making a shell script executable, take advantage of the fact that the env utility is located in /usr/bin on most systems. So, for example, for maximum portability a Python script should start with:

#!/usr/bin/env python

rather than being hard-pathed to wherever Python happens to be on your system. The great thing is that this approach works with virtual environments also, sourcing the python that happens to be appropriate to your currently active virtualenv.