- What is Kernel?
The kernel is a computer program that is the core of a computer’s operating system, with complete control over everything in the system.
- What is Shell?
A shell is a special user program that provides an interface for the user to use operating system services. Shell accepts human-readable commands from users and converts them into something which the kernel can understand. It is a command language interpreter that executes commands read from input devices such as keyboards or from files. The shell gets started when the user logs in or start the terminal.
- What is Linux Shell Scripting?
A shell script is a computer program designed to be run by a Linux shell, a command-line interpreter. The various dialects of shell scripts are considered to be scripting languages. Typical operations performed by shell scripts include file manipulation, program execution, and printing text.
- Explain in your own words and examples, what is Shell Scripting for DevOps.
Shells are interactive, they accept the command as input from users and execute them. Shell can also take commands from a file; we can write these desired commands in a file and can easily execute them in the shell to avoid repetitive work. Such files are called Shell Scripts or also called Shell Programs. A shell script is a text file that contains a sequence of commands for a UNIX-based operating system. It is called a shell script because it combines a sequence of commands, that would otherwise have to be typed into the keyboard one at a time, into a single script.
What is
#!/bin/bash?
can we write#!/bin/sh
as well?It defines an absolute path /usr/bin/bash to the Bash shell. This is usually the default location of the Bash shell in almost all Unix-based operating systems. This shebang line is used to execute commands with the Bash interpreter. Yes, we can write '#!/bin/sh' as well as bash is sh, with more features and better syntax. Most commands work the same.
Write a Shell Script that prints
I will complete the #90DaysOofDevOps challenge
script:-
#!/bin/bash
echo "I will complete #90DaysOofDevOps challenge"
- Write a Shell Script to take user input, input from arguments and print the variables.
script:-
#!/bin/bash
#get user's name as input
echo "what is your name:"
read the name
#input from arguments
position=$1
#print the variable
echo "name:$name"
echo "position:$position"
Write an Example of If else in Shell Scripting by comparing 2 numbers
script:-
#!/bin/bash num1=$1 num2=$2 if [ $num1 -gt $num2 ] then echo "$num1 is greater than $num2" else echo "$num2 is greater than $num1" fi
thanks for reading.. Suggestions are welcome!
refer to my GitHub repo -
https://github.com/SumitRamchandra/90DaysOfDevOps.git
happy learning!!!
Thank you - Shubham Londhe