DevOps Day-4 Basic Linux Shell Scripting for DevOps Engineers
The challenge is for the DevOps Community to get stronger in DevOps

I am a highly skilled QA and testing manager with over 19 years of experience in the industry. I am passionate about ensuring the delivery of high-quality software and have a proven track record of successful project delivery. Additionally, I have extensive experience as a DevOps engineer, which has given me a deep understanding of the software development lifecycle and the importance of collaboration between teams. I am committed to staying up-to-date with the latest technologies and methodologies in the industry and am always seeking new challenges to enhance my skills.
What is Kernel
The kernel is a computer program that is the core of a computer’s operating system, with complete control over everything in the system.
What is Shell
A shell is a special user program that provides an interface for users to use operating system services. Shell accepts human-readable commands from a user and converts them into something which 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.
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.
Tasks
Explain in your own words and examples, what is Shell Scripting for DevOps.
What
#!/bin/bash?can we write#!/bin/shas well?Write a Shell Script that prints
I will complete the #90DaysOofDevOps challengeWrite 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
Was it difficult?
- Post about it on LinkedIn and Let me know :)
Article Reference: Click here to read basic Linux Shell Scripting
YouTube Video: EASIEST Shell Scripting Tutorial for DevOps Engineers
Shell scripting for DevOps is the process of writing scripts or programs using shell commands to automate repetitive tasks, perform system administration tasks, and improve efficiency in the DevOps process. Shell scripting allows DevOps engineers to automate routine tasks, reduce human error, and streamline the deployment process. DevOps engineers can use shell scripting to automate tasks such as software installation, system configuration, and testing.
The #!/bin/bash is called a "shebang" line, which specifies the interpreter for the script. It tells the operating system which interpreter to use to run the script. The shebang line specifies that the script should be interpreted by the bash shell. Yes, we can write #!/bin/sh as well, which specifies that the script should be interpreted by the default system shell.
Here are some examples of Shell Scripting:
- Shell script to print "I will complete #90DaysOfDevOps challenge":
bashCopy code#!/bin/bash
echo "I will complete #90DaysOfDevOps challenge"
- Shell script to take user input, input from arguments, and print the variables:
bashCopy code#!/bin/bash
echo "Enter your name: "
read name
echo "Your name is $name"
if [ $# -eq 2 ]; then
echo "Argument 1: $1"
echo "Argument 2: $2"
else
echo "No arguments provided"
fi
- Example of if-else in shell scripting by comparing 2 numbers:
bashCopy code#!/bin/bash
a=10
b=20
if [ $a -gt $b ]; then
echo "a is greater than b"
else
echo "b is greater than a"
fi
