Running python commands in solaris os -
i have 1 python file (abc.py) include several commands make directory, copy commands. want execute such that,whenever hit command example abc --makedir on console, should make directory. makedir function written in abc.py.
rename abc.py
abc
.
make executable:
chmod +x abc
then add @ first line of script:
#!/usr/bin/python
from command line (if abc
in python path):
#abc
to create directory said , should parse arguments passed python script.
for example:
import sys if len(sys.argv)>1: if sys.argv[1] == '--makedir': makedir()
for more informations @ link what's best way grab/parse command line arguments passed python script?
Comments
Post a Comment