Shell Script
Shell Script
Bourne Shell
This is the default shell for version 7 Unix. The character $ is the default prompt for the
bourne shell. The different subcategories in this shell are Korn shell, Bourne Again shell,
POSIX shell etc.
C Shell
This is a Unix shell and a command processor that is run in a text window. The character
% is the default prompt for the C shell. File commands can also be read easily by the C
shell, which is known as a script.
Batch jobs
Programming
o There are many features in modern shell scripts that are only found in
sophisticated programming languages such as arrays, variables, comments
etc. Many complicated applications can be written in shell scripts using these
features. But there is a problem i.e. shell script languages don’t support
classes, threading etc.
Generalization
o It is much more flexible to use loops, variables etc for multiple tasks in shell
script. An example of this is a Unix shell script known as bash, which converts
jpg images to png images.
Shortcuts
o There is a shortcut provided by a shell script for a system command where
command options, environment settings or post processing apply. This still
allows the shortcut script to act as a Unix command.
To run your script in a certain shell (shell should be supported by your system), start
your script with #! followed by the shell name.
Example:
1. #!/bin/bash
2. echo Hello World
echo "Hello"
echo $SHELL
var1=9
pwd
ls -l
else
fi