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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -