π Day4: Basic Linux Shell Scripting π for DevOps π»

"Passionate and aspiring DevOps Engineer with a flair for automation and a hunger to optimize the software delivery lifecycle. As a recent graduate in Computer Science, I'm excited to dive into the world of DevOps, combining my coding skills with a deep interest in infrastructure management and continuous integration. With a knack for problem-solving, I'm on a mission to streamline processes, enhance efficiency, and drive collaboration across development and operations teams. Join me as I embark on this journey of learning, experimenting, and contributing to the evolving landscape of DevOps."
What is a kernel?

In Linux, the kernel is the core part of the operating system responsible for managing hardware resources, process scheduling, memory management, and providing essential system services. It acts as an intermediary between software applications and hardware components.
Example:
The kernel plays a role in powering web servers. It acts as the foundation for web server software like Apache and Nginx, facilitating the hosting of websites and serving content to users worldwide.
What is Shell?

A shell is a command-line interface that allows users to interact with the operating system by typing text commands. It interprets these commands and communicates with the operating system kernel to execute them. Shells can also be used for scripting and automation tasks. Popular Linux shells include Bash, Zsh, and Fish. The user requests operate to the shell first and then the kernel executes it.
Example:
Imagine you're updating your Linux system. You open a terminal and use a shell command (e.g., sudo apt-get update), and the shell communicates with the OS to fetch and install the latest software updates.
Write a Shell Script that prints: I will complete the #90DaysOofDevOps challenge
Create a text file with the command
nanowhich ends with.sh. Likenano myscript.sh. Every file that ends with.shis a shell script file.
Then start the shell script with
#!/bin/bashand use theechocommand to print the statement.
Then change the file permissions with
chmodcommand.
Execute the file by using
./<file_name>to print the content written in the file.
Write a Shell Script to take user input, input from arguments and print the variables:
As you know, first create a txt file with the
nanocommand that ends with.sh. e.g.nano user-input.sh.Then
readcommand is used to get input from the user,$sign is used to get the arguments e.g.$1, andechois used to print the variables e.g.echo "<statement>: <variable_name>"
Then change the permissions of the file with
chmodcommand as mentioned before.Then use
./<bash_file_name>to show the content of the file.
Write an example of if else in Shell Scripting by comparing 2 numbers:

In the script file:
We define two numbers
'number1'and'number2'.We use
if elseto compare two numbers.-eqchecks if the numbers are equal.fiused to close theif elsefunction.Depending on the result, the script prints the appropriate number.
You can modify the
'number1'and'number2'to test the scenario.
<THE END>





