Created
November 27, 2011 18:43
-
-
Save nkabir/1397960 to your computer and use it in GitHub Desktop.
Python Runner Scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
if __name__ == "__main__": | |
print sys.argv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# usage: pyrunner.sh [python-script] [arguments] ... | |
# Let's set our PYTHONPATH so our python script can load all needed libraries | |
export PYTHONPATH=$HOME/hgdev/org.bitbucket/$USER/pywork | |
# The first argument is the name of the python script we want to run | |
pyscript=${1} | |
# the "shift" command moves all arguments to the left, deleting the first one | |
shift | |
# The $@ is a special Bash variable that contains the list of command line arguments | |
python ${pyscript} $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./pyrunner.sh paypv.py 1 2 3 4 5 | |
['paypv.py', '1', '2', '3', '4', '5'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment