Shell Scripting

Shreya BhatShreya Bhat
2 min read

#Day4 of #90DaysOfDevopsChallenge

✅What is Kernel?

The Linux kernel is the main component of a Linux operating system (OS) and is the core interface between a computer’s hardware and its processes. It communicates between the 2, managing resources as efficiently as possible.

✅What is Shell?

A shell is special user program which provide an interface to user to use operating system services. Shell accepts human readable commands from user and convert them into something which Kernel can understand. It is a command language interpreter that execute commands read from input devices such as keyboards or from files. The shell gets started when the user logs in or start the terminal.

✅What is Linux Shell Scripting?

A shell script is a computer program designed to be run by a Linux shell, a command-line interpreter. The various dialects of shell scripts are considered to be scripting languages. Typical operations performed by shell scripts include file manipulation, program execution, and printing text.

✅What is #!/bin/bash? can we write #!/bin/sh as well?

sh => Bourne Shell sh used to be a shell called bourne shell back in 1977. sh is typically a minimalistic shell that lacks some of the advanced features of Bash.

bash => Bourne Again Shell Bash is an extended version of the Bourne shell (sh) and provides additional features such as command line editing, improved job control, and enhanced scripting capabilities.

bash and sh are two different shells with different features.

Both #!/bin/bash and #!/bin/sh are called shebangs and are used to specify the interpreter for a script in Unix-like operating systems.

#!/bin/bash specifies that the script should be interpreted by the Bash shell, which is a popular shell used in many Linux distributions.

#!/bin/sh specifies that the script should be interpreted by the default system shell, which may or may not be Bash. In many Unix-like systems, sh is a symbolic link to a specific shell, such as Bash or the original Bourne shell.

In summary, if you want to use Bash-specific features in your script, you should use #!/bin/bash. However, if your script only uses standard POSIX shell features, you can use #!/bin/sh for improved portability.

✅Write a Shell Script which prints I will complete #90DaysOofDevOps challenge ?

Key Syntax for the execution access : chmod a+x filename.sh

✅Write a Shell Script to take user input, input from arguments and print the variables?

✅Write an Example of If else in Shell Scripting by comparing 2 numbers ?

fi😃

#devops #trainwithshubham #90daysOfDevopschallenge

1
Subscribe to my newsletter

Read articles from Shreya Bhat directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shreya Bhat
Shreya Bhat

I write blogs about DevOps current and emerging tools/technologies.