The power of Shell Scripting

Dream. Dare. Do – that is Suyati’s work principle in a nutshell.

Jun
27
2013
  • Author:
  • NaveenBos

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.

Selection_001

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:

first

User defined variables(UVD) in shell script:-

Selection_011

The output will be bus.

Arithmatic operations:

Selection_012

Example: palindrome

Selection_013

Output:

1st

How to make a colour full chess board using shell script in our terminal?

Selection_017

Output:

second

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.

03

Leave a Comment

Your email address will not be published. Required fields are marked *