Day 4 Task: Basic Linux Shell Scripting for DevOps Engineers
Naushad khan
Cloud Engineer | AWS Certified Solution Architect | Nutanix Certified Associate | Linux | Git & GitHub | Docker | Jenkins | ManageEngine (MECP) | Monitoring and Logging
Hello, everyone! On Day 4 of my #90DaysOfDevOps challenge, I explored Linux shell scripting and learned some key concepts.#90daysofdevops with Shubham Londhe Here’s what I discovered:
Day 4 Task: Basic Linux Shell Scripting for DevOps Engineers
What is Kernel?
In simple terms, the kernel is like the engine of your computer's operating system. It’s the core part that acts as a bridge between the hardware (like your CPU, memory, and devices) and the software (programs and applications you run).
Here’s how it works in layman’s language:
So, the kernel is vital for making sure your computer runs efficiently by managing all the low-level stuff behind the scenes.
What is Shell?
The shell is like a translator between you and your computer.
Here’s a simple breakdown:
If you’ve ever used a command line or terminal (where you type commands instead of clicking), that’s a type of shell. It helps you communicate directly with the computer by typing commands instead of using a mouse or icons.
So, while the kernel runs the system, the shell helps you talk to the kernel.
What is Linux Shell Scripting?
Linux shell scripting is like giving your computer a list of tasks to do automatically, instead of doing them one by one.
In simple words:
It’s like writing a recipe for the computer, where each step in the recipe is a command, and once the script runs, the computer follows your instructions exactly, saving you time and effort.
??? Tasks I Completed:
1.????? Explain in your own words and with examples what Shell Scripting means for DevOps.
?In DevOps, shell scripting is a way to automate repetitive tasks and processes to make everything run faster and more consistently.
For example:
In short, shell scripting in DevOps helps streamline workflows, making processes more efficient and reliable.
?
2.????? What is?#!/bin/bash? Can we write?#!/bin/sh?as well?
The line #!/bin/bash or #!/bin/sh at the top of a script is called a shebang. It tells the system which shell to use to run the script.
Yes, you can write #!/bin/sh instead of #!/bin/bash, but keep in mind that some commands or features available in Bash may not work in sh.
领英推荐
In short:
?
3.???? Write a Shell Script that prints?I will complete #90DaysOfDevOps challenge.
Create a new file, e.g., Devops_Script.sh
Give it execute permissions using: chmod 700 (+x) Then Run the script.
4.????? Write a Shell Script that takes user input, input from arguments, and prints the variables.
Give it execute permissions using: chmod 700 (+x) Then Run the script.
Run the script, passing arguments (e.g., "DevOps" and "Challenge")
5.????? Provide an example of an If-Else statement in Shell Scripting by comparing two numbers.
Here's a simple example of an if-else statement in shell scripting that compares two numbers:
Explanation:
It will prompt you to enter two numbers and then display the comparison result!
?
Founder & CEO @ WebtechAge Pvt Ltd & Role Route | Delivering Total Talent Solutions
4 个月Hi, I hope this message finds you well. I wanted to reach out and connect with you. As part of our recruitment services, we’re currently offering four candidate CVs free of cost to help meet your hiring needs. I believe this could be a great opportunity for your organization to find the right talent. Let’s connect to explore how we can assist in fulfilling your recruitment requirements. Looking forward to staying in touch! Best regards, Rohit Raghav Founder, (Webtech Age Pvt Ltd)