Linux Shell Scripting for DevOps ๐Ÿง๐Ÿ“๐Ÿ”ง

Linux Shell Scripting for DevOps ๐Ÿง๐Ÿ“๐Ÿ”ง

Day - 6 #90daysofdevoschallenge

ยท

2 min read

What is Kernel? ๐ŸŒ

The Linux Kernel is like the heart of a computer system. It is the central core that manages all the hardware and software interactions.

What is Shell? ๐Ÿš๐Ÿ–ฅ๏ธ

A shell is a special user program that provides an interface for users to use the operating system. Shell accepts human-readable commands from users and converts them into something which the kernel can understand.

Task-1 Explain in your own words and examples, what is Shell Scripting for DevOps. ๐Ÿ’ป๐Ÿ”งโœจ

A shell script is a script written for the shell, of an operating system. Shell scripts are used to automate the frequently performed operations and to run the sequence of commands as a single command. With the help of shell scripts, we automate the repetitive tasks.

For example, We have backup activity in our environment so with the help of shell scripts we backup data daily and stored it in any location. For installing packages, and configuring tools, we also used shell scripts.

Task-2 What is #!/bin/bash? can we write #!/bin/sh as well? ๐Ÿ“๐Ÿš๐ŸŒŸ

#! /bin/bash is called a "shebang" line at the beginning of a script file. It is used to specify the interpreter that should be used to run the script. When you execute a script with this shebang, the system will automatically launch the specified interpreter to interpret and execute the script's commands.

#! /bin/sh is also a shebang line used to specify the default system shell (commonly the Bourne shell) as the interpreter for the script. The Bourne shell /bin/sh is a minimalist shell, and its features may vary slightly depending on the operating system.

The choice between #! /bin/bash and #! /bin/sh depends on the specific requirements of your script.

Task-3 Write a Shell Script which prints I will complete #90DaysOfDevOps challenge. ๐Ÿ“๐Ÿš๐Ÿ“…

Task-4 Write a Shell Script to take user input, input from arguments, and print the variables. ๐Ÿ“๐Ÿš๐Ÿ–จ๏ธ

This script used the read utility to read user input and stored the input in the number1 variable.

-p option used for the prompt for user input.

Task-5 Write an Example of If else in Shell Scripting by comparing 2 numbers. ๐Ÿ“๐Ÿšโž•โž–

ย