Skip to content

Instantly share code, notes, and snippets.

@jimmybot
Last active July 13, 2018 08:14
Show Gist options
  • Save jimmybot/776f8a1eb2f46a0421e9d87a20c13ec2 to your computer and use it in GitHub Desktop.
Save jimmybot/776f8a1eb2f46a0421e9d87a20c13ec2 to your computer and use it in GitHub Desktop.
Running Python scripts using the Python interpreter dynamically from the local virtual env rather than hardcoding a full path
#!/bin/sh
"exec" "`dirname $0`/python" "$0" "$@"
"exit $?"
print('hello from my double entendre script!')
print('a python script that runs as both sh that then runs the same script as sh')
raise Exception("things didn't go well: check my exit code is 1")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment