linux - Calling a python function with options from shell script -
i have python script takes various options command line
e.g.
-runs gui
python myscript.py -gui
-runs without requiring user prompts
python myscript.py -aut
-runs input data taken input.py
python myscript.py input.py
-and combinations of above e.g. runs automatically taking input input.py
python myscript.py -aut input.py
i able call anywhere on linux box. how can this? have tried aliasing in .bashrc file, using method unable accept of input options. have tried
export path=$path:/path/to/folder/above_myscript/
but recognises command if type myscript, not python myscript . typing myscript unable run python script.
i have tried writing shell script call.
#!/bin/bash #file: myscript.sh python '/path/to/folder/above_myscript/myscript.py'
however, again unable pass options it. best solution problem?
if add #!/usr/bin/env python
top of myscript.py file , run chmod +x myscript.py
on should able run myscript.py
without needing put python
before it. should let use path
changing method had before.
Comments
Post a Comment