user3565150
user3565150

Reputation: 914

Bash script in Python os.system

I need to execute the bash script Do_Regr.sh with the following arguments in a linux server:

./Do_Regr.sh -i Testlist_Regression.in -m 135.24.237.167 -g

How do I run the above in a Python script using os.system() ?

Upvotes: 2

Views: 1269

Answers (1)

vks
vks

Reputation: 67988

import subprocess
subprocess.Popen("./Do_Regr.sh -i Testlist_Regression.in -m 135.24.237.167 -g",shell=True)

This should do it.Make sure your python script is also in the same directory or use os.chdir to get there.

Upvotes: 1

Related Questions