What is a shebang?

A shebang is a one-line character sequence that is added at the first line of a file.

A shebang consists of a hash sign and an exclamation mark (#!).

A file which has a shebang can be executed by a *nix system. The *nix system interprets the code according to the shebang (extensions are not to be noted by the system when shebangs are used).

Letโ€™s say I have a txt file with a shebang #!/bin/sh . When I execute the file, the program loader of the *nix system will parse the txt file and execute it according to the shebang as /bin/sh . Shebangs make workflow easier when coding.

The hash sign is usually ignored as it resembles comments. Albeit some programming language interpreters do not use the hash sign as it may be interpreted as a comment and ignored.

Hope you learnt what is a shebang from this short message :slight_smile:

Thatโ€™s all for now.