Unix Shell Scripting -Introduction to Shell Scripting.
Introduction to Shell Scripting:
Collection of UNIX commands, in every operating system shells are present.
Shell is a bunch of UNIX commands.
We are adding all the required commands in a file.
Every shell file is with the extension of .sh
Basically Bash is a default shell in scripting language.
How to know current shell?
This shell command will return the current shell which is running.
Why to use shell,
- For to automate daily operations.
- For to customize the work environments.
- Automate important system operations like shutting down systems.
- Perform same operation on many files at a time.
Types of Shell:
- Bourne Shell
- ‘C’ Shell
- KORN Shell
Types of Shell in Brief:
- Bourne Shell:
The Bourn Shell is also call as standard shell. It is default shell. Having extension as .sh to it’s file. Bourne shell is created by Stevan Bourne. This shell is prmpt is $ and execution command is ‘sh’.
- ‘C’ Shell:
This shell is includes many of the syntaxes are like C programming due to that reason this shell is call as ‘C Shell’. This shell was created by Bill Joy at university of California.
The shell prompt is ‘%’ and execution is Csh.
- KORN Shell:
The KORN shell is developed by David Korn at AT & T Bell Laboratories. This shell becomes one of main Salvos in AT & T’s response to the growing popularity of BSD UNIX.
Responsibilities of Shell:
- Environment control
- Interpreted programming language
- Input output redirection
- Program execution
- Pipeline hookup
Variable is a data name given to store a value.
Type of Variables:
Two Types of Shell Script:
- Interactive shell script:
While execution of shell script user inputs are required that is known as interactive shell script.
- Non-Interactive shell script:
While execution of script no need of user interaction or any type of inputs is known as non-interactive shell script.