#Day4 Task: Basic Linux Shell Scripting for DevOps Engineers

#Day4 Task: Basic Linux Shell Scripting for DevOps Engineers

#Day4 of 90DaysOfDevOps

What is Kernel?

Ans:- The kernel is like the Brain of an operating system. It controls and manages all the important things that happen on a computer, such as managing memory, running programs, communicating with hardware devices, and handling input/output operations. Without the kernel, the operating system and the computer would not be able to function properly.

What is Shell?

Ans:- In computing, a shell is a command-line interface that allows users to interact with an operating system by entering commands. A shell provides a way for users to execute commands, run programs, and access system resources.

There are many different shells available for various operating systems, such as Bash (Bourne-Again SHell), Zsh (Z Shell), Ksh (Korn shell), and PowerShell (for Windows). Each shell has its own set of features, syntax, and commands.

What is Linux Shell Scripting?

Ans:- Linux shell scripting is the process of writing scripts in the Linux shell to automate tasks and manage system resources.

The Linux shell is a command-line interface that provides users with access to the operating system's services and resources.

A shell script is a program that is written in the shell's scripting language and executed by the shell interpreter & a shell is a powerful tool that allows users to perform complex tasks by executing commands and scripts.

What is Shell Scripting for DevOps?

Ans:- Shell scripting is a powerful tool for DevOps engineers that allows them to automate tasks, manage infrastructure, reduce errors and deploy software more efficiently. DevOps is a methodology that emphasizes collaboration and communication between development and operations teams to deliver software faster and more reliably.

What is #!/bin/bash? can we write #!/bin/sh as well?

Ans:- #!/bin/bash is known as the "shebang" and it is a special syntax that tells the OS which interpreter to use to run the script. In this case, #!/bin/bash tells the system to use the Bash shell interpreter to run the script.

Yes, it is also possible to write #!/bin/sh instead of #!/bin/bash.

#!/bin/bash Bash is a popular shell that is widely used in Linux and Unix systems.

#!/bin/sh is used to specify that the Bourne shell should be used to interpret the script. The Bourne shell is an older shell that is still available on most Unix-like systems. It is a simpler shell compared to Bash and lacks some of the advanced features that are available in Bash.

Write a Shell Script that prints I will complete #90DaysOofDevOps challenge.

Ans:- vim devops.sh

#!/bin/bash

echo "I will complete #90DaysOfDevOps Challenge"

chmod 700 devops.sh

./devops.sh

Output

I will complete #90DaysOfDevOps Challenge

Write a Shell Script to take user input, input from arguments and print the variables.?

Ans:- vim dayq7.sh

chmod 700 dayq7.sh

cat dayq7.sh

./dayq7.sh

Aur Bhai Ksa Hai

ek dam mast

Hn Bhai ek dam mast

Write an Example of If else in Shell Scripting by comparing 2 numbers.?

Ans:-

Code

Output

ThankYou So Much For Reading๐Ÿง๐Ÿ˜…๐Ÿงก

Saumya Ranjan Mohapatra

ย