Shell is an interface that takes user input and converts it into something that Kernel can understand. It allows users to communicate efficiently and directly with their operating systems.
Shell scripting is a type of computer program with a bunch of commands that need to be executed by Shell to perform classic operations and are generally used to automate the processes.
Shell scripts don’t always go by the same name. Sh,
Bash (the most common), csh,
ksh,
, and zsh,
are all shell scripts.
The script starts with this #!/bin/bash, which is called shebang. It is used to define which interpreter or type of shell is being used.
Some basic shell scripts are given below:-
Example 1
#!/bin/bash
#It creates a new variable with a value of "Hello World"
learningbash="Hello World"
echo $learningbash
Example 2
#!/bin/bash
name="Parth" echo "Hi $name, Please enter your age"
read age
if [ "$age" -gt 30 ]
then echo "$name is greater than 30 "
else echo "$name is smaller than 30 "
fi
~
~
~
OUTPUT:
I kept it very short and simple, Hope it was helpful.
Thanks for reading this out.