Introduction To Bash Scripting
Bash history goes to the early 1970’s when first bash version is released with mainstream Unix operating system. Bash is then ported into a lot of different platforms like Ultrix, AIX, SunOS, Linux. Bash is the shell and command interpreter for Linux,Unix,BSD etc. operating systems. Bash is the acronym of Bourne-Again Shell . Bash adds a lot of feature to the standard sh . Alternative to bash is csh, ksh but bash is most user friendly shell.
Shell is friendly interface for us from operating system. Operating systems have ugly and complex interfaces to use so they shows us bash as more convenient interface. Bash gets input from user interactively or batch mode and parse/interpret them and then call appropriate operating system functions.
As you can understand that shells main job is to translate user commands into operating system instructions. Bash have built-in commands like cd, break etc. Bash can provide programming language options like flow control, variable, function etc.Bash runs commands on operating system and provides some shortcuts for operations. Bash can run interactively or non-interactively. In non-interactive mode commands reads generally from a file. Bash have all of the features of the standard Bourne Shell and a lot of extra features of the C and Korn shells.
To learn current default shell simple run following command in your terminal.
$ echo $SHELL
If you default shell is not bash run following command to call bash shell.
If you have all ready a bash and you run the above command again you will get and bash in bash shell.
When Not To Use Scripts
Scripts provides practical, fast and convenient way to solve problems but some times using bash may not be an ideal solution. Here are some of the them.
- Network related jobs
- High IO jobs
- Cross platform jobs
- Mission critical jobs
- Gui related jobs