Harpal Harpal - 1 year ago 63
Python Question

Shell Script: Execute a python program from within a shell script

I've tried googling the answer but with no luck.

I need to use my works supercomputer server, but for my python script to run, it must be executed via a shell script.

For example I want

to execute

How can this be accomplished?

Answer Source

Just make sure the python executable is in your PATH environment variable then add in your script

python path/to/the/python_script.py


  • In the file job.sh, put this
python python_script.py
  • Execute this command to make the script runnable for you : chmod u+x job.sh
  • Run it : ./job.sh
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download