Note: Most of these blogs are for my personal reference and at a given time, some of those might just be unpolished drafts.

Shebang (what does "#!/bin/bash" do at the start of bash scripts?)

Demonstration by Example

This was originally answered by me at Quora

sleep 50

let’s save it as and make it executable

sudo chmod +x

Let’s run it in the background and stat the process.

[1] 11660

On looking at the process details:

 ps -fp 11660
sudipbh+ 11660 11330  0 15:30 pts/7    00:00:00 /bin/sh ./

We can see that the content of the file is passed as an argument to the program /bin/sh.

In Bash scripting, this enables the script author to mention the exact interpreter to be used by the program and if it’s not found the user can take it as a cue to install the required interpreter.

The same idea would be extended to other interpreted languages like python.

Written on March 14, 2019