Day 4 - Basic Linux Shell Scripting for DevOps Engineers
What is Kernel?
The kernel in Linux is like the heart of the operating system. It controls how the computer uses its hardware, manages memory, and allows programs to run. It acts as a bridge between your software (like apps) and the physical parts of your computer (like the CPU and memory). Essentially, it makes everything work together smoothly!
What is Shell?
A shell is a special user program that provides an interface for users to interact with operating system services. It accepts human-readable commands from users and converts them into instructions that the kernel can understand. The shell is a command language interpreter that executes commands read from input devices such as keyboards or from files. It starts when the user logs in or opens a terminal.
What is Linux Shell Scripting?
Linux shell scripting involves writing programs (scripts) that can be run by a Linux shell, such as bash (Bourne Again Shell). These scripts automate tasks, perform system administration tasks, and facilitate the interaction between users and the operating system.
Tasks:
1.Explain in your own words and with examples what Shell Scripting means for DevOps.
-Shell scripting helps automate repetitive task like backup.
Ex. A scripts can automatically backup your files every day.
2.What is #!/bin/bash
? Can we write #!/bin/sh
as well?
-The line #!/bin/bash
is called a "shebang."
It tells the system that the script should be run using the Bash shell. This is often the first line in shell scripts and specifies the path to the interpreter.
3.Write a Shell Script that prints I will complete #90DaysOfDevOps challenge
.
4.Write a Shell Script that takes user input, input from arguments, and prints the variables.
5.Provide an example of an If-Else statement in Shell Scripting by comparing two