Bash script to run python script with arguments

Method 1:  Create a shell script:

  • Suppose you have a python file hello.py
  • Create a file called job.sh that contains
#!/bin/bashpython hello.py
  • make it executable
$ chmod +x job.sh
  • run it
$ ./job.sh

Method 2:  Make the python itself run from shell:

  • Modify your script hello.py and add this as the first line
#!/usr/bin/env python
  • make it executable
$ chmod +x hello.py
  • run it
$ ./hello.py