What is Kernel
The kernel is the heart of the operating system. The term kernel often refers to the operating system. The critical code of the kernel is stored in a special memory area to protect it from other programs. It is a vital component as it is the basis for the proper functioning of the entire system. The kernel performs a variety of tasks including process management, managing hardware devices and handling interrupts.
What is Shell
A shell is a special user program which provides an interface for the user to use operating system services. Shell accepts human-readable commands from a user and converts them into something the kernel can understand. It is a command language interpreter that executes commands read from input devices such as keyboards or from files. The shell gets started when the user logs in or start the terminal.
The main difference between kernel and shell is that the kernel is the core of the operating system that controls all the tasks of the system while the shell is the interface that allows the users to communicate with the kernel.
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?
#!/bin/bash or #!/bin/sh
is known as ‘she-bang‘(shabang)
This derives from the concatenation of the tokens sharp (#) and bang (!). It is also called as sh-bang, hashbang, poundbang or hash-pling. In computing, a she-bang is the character sequence consisting of the characters number sign and exclamation mark (#!) at the beginning of a script.
#!/bin/bash
echo "I will complete #90DaysOofDevOps challenge" > ~/output.txt
Write a Shell Script to take user input, input from arguments and print the variables.
#!/bin/bash
# Ask the user for their name
echo "Hello, who am I talking to?"
read varname
echo "It\'s nice to meet you $varname"
Write an Example of If else in Shell Scripting by comparing 2 numbers
#!/bin/bash
# Script to do numeric comparisons
var1=10
var2=20
if [ $var2 -gt $var1 ]
then
echo "$var2 is greater than $var1"
fi
# Second comparison
If [ $var1 -gt 30]
then
echo "$var is greater than 30"
else
echo "$var1 is less than 30"
fi
Thanks for reading my article. Have a nice day.
For updates follow me on LinkedIn: Swapnil Khairnar
Hashtags:
#90daysofdevops #devops #cloud #aws #awscloud #awscommunity #docker #linux #kubernetes #k8s #ansible #grafana #terraform #github #opensource #90daysofdevops #challenge #learningprogress #freelancer #linkedin #trainwithshubham #devopscommunity #cloudproviders #bash #bashshellscripting #awkward #shellscripting