Calling python script from bash

From raju

Sample scripts to demonstrate how to call a python script from bash.

Create a shell script that calls a pythyon script which prints the current working directory.

    #! /usr/bin/env bash
    set -e
    set -u
    echo directory = $dir
    #! /usr/bin/env python
    import os
    $chmod +x

Run the script

    directory = H:\work\x

Run the script in a different directory

    $cd "C:\users\kkusuman"
    directory = C:\users\kkusuman