Created
September 29, 2014 22:48
-
-
Save nopjia/73d997fca77237d59399 to your computer and use it in GitHub Desktop.
Python Command-line
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/python | |
import os, sys | |
def main(): | |
# Command-line Processor | |
cmd_dir, cmd_name = os.path.split(os.path.abspath(sys.argv[0])) | |
cmd_args = sys.argv[1:] | |
print "Working Dir:\t" + cmd_dir | |
print "Command Name:\t" + cmd_name | |
if len(cmd_args): | |
print "Received %s Arguments:" % (len(sys.argv)-1) | |
for s in sys.argv[1:]: | |
print s | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment