Shell script, in Linux OS, is defined as the series of commands written in a text file. This program accepts instructions or commands from users in English, and converts it to binary language. Shell scripts are more powerful than the MS-DOS and acts as a mediator for kernel – the heart of Linux. Shell uses the system kernel to execute programs, create files and more.
Here we are checking some Shell scripts in Linux. First create a file with an extension of .sh. Here I have used gedit you can use any editors, and change the file permissions to executable format, for that we are using sudo chmod 755 filename.
How can we run this file in our terminal, we can use both commands for shell script running in terminal.
./first.sh or bash first.sh
The output look like this:
User defined variables(UVD) in shell script:-
The output will be bus.
Arithmatic operations:
Example: palindrome
Output:
How to make a colour full chess board using shell script in our terminal?
Output:
These are all simple examples to illustrate the power of shell scripting. Shell script will reduces the complexity of code. We can make cronjobs using shell scripts.
The below script is used for copying files to a backup folder, in shell script we can make it easily but in other languages the line of code will increase and it make more complex.
The power of Shell Scripting
previous post