Linux /bin/bash Shell and Script Tutorial
Linux Bash shell is the most popular shell. /bin/bash is the path and executable of the Bash shell. /bin/bash is a binary which is used in different ways to run and execute commands and scripts.
Script File Interpreter #!/bin/bash
In Linux and opensource world script files are very important. There are different type of scripting language used to write script files. As file extension is just a label for a script file script file interpreter line is used to specify the scripting language.
#!/bin/bash specifies that current file is a bash script which will be interpreted with the bash or interpreter
! makes this line special because
# is used as comment line in bash.
! is called
Bash is very popular shell but there are a lot of alternatives to the Bash. Here is some of them.
- SH is very basic shell which provides fundamental features of the Bash.
- KSH is Korn shell which is similar to the BASH
- CSH is mainly designed from C programming language.
Difference Between #!/bin/sh and #!/bin/bash
As stated previously bash binary is stored in the
/bin/bash path in general.
/bin/sh provides the SH shell which is cirppeled down version of the BASH.
Detailed information can be listed with the
man command like below. This provides detailed information about the
BASH shell and related commands.
$ man bash
$ man /bin/bash