I am writing a python script which uses os.system
command to call a shell script.I need help understanding how I can pass the arguments to the shell script? Below is what I am trying..but it wouldn't work.
os.system('./script.sh arg1 arg2 arg3')
I do not want to use subprocess
for calling the shell script. Any help is appreciated.
If you insert the following line before os.system (...), you will likely see your problem.
print './script.sh arg1 arg2 arg3'
When developing this type of thing, it usually is useful to make sure the command really is what you expect, before you actually try it.
example:
when you are satisfied, comment out the
print Cmd()
line and useos.system (Cmd ())
or subprocess version.