2

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() ?

1 Answer 1

1
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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for the quick reply, and another quick question: if I need to do /bin/bash followed by source of some shell script or .env file, then should I follow the same steps? Its like '/bin/bash' followed by source /sf/tools/firmware/fwenv.sh; source ~/griffin.env which I do and then run the above script

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.