Larry Wall: “Shell programming is a 1950s juke box …”
In this short blog I write a small Python utility script to create directories and demonstrate how to utilize it and pass it arguments via BASH shell script. The functionality is similar to the ‘mkdir’ UNIX command. The name of the directory or directories to be created is the argument I pass in to the Python script. I then create a BASH shell script to call the Python script.
The BASH shell script file takes in a argument(s) and passes the argument(s) to the Python script file. I make the BASH script file an executable with the “chmod +x [BASH script name]” command; I can then put this small utility script in one my path directories as shown by the “echo $PATH” command and call it anytime as needed from the shell.
Python script code (mkd.py):
BASH shell script code (mkd):
Follow me on Twitter: @Humair_Ahmed