Devops Day4

Devops Day4

Task: Basic Linux Shell Scripting for DevOps Engineers.

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 special user program which provide an interface to user to use operating system services. Shell accept human readable commands from user and convert them into something which kernel can understand. It is a command language interpreter that execute 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 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.

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

#!/bin/bash is called a shebang (or hashbang) and is a special character sequence at the beginning of a script or program file in Linux operating systems. It has a specific purpose:

  • Interpreter Specification: It tells the system which interpreter to use for running the script.

  • #!/bin/bash specifies that the script should be interpreted and executed by the Bash shell.

Execution Permission: When you have the shebang line at the top of your script and you make the script file executable, you can run the script directly without explicitly specifying the interpreter. For example, if your script is in a file named script1, you can run it with ./script1 instead of bash script1.

How this works :: When you execute a script with ./script1, the operating system looks at the shebang line, in this case, #!/bin/bash, and uses the specified interpreter (in this case, Bash) to run the script.

We can also use #!/bin/sh to specify the system's default shell as the interpreter. In most Unix-like systems, /bin/sh is a symbolic link or a symlink to the default system shell, which can be Bash or another shell, depending on the system's configuration

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

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

Write an Example of If else in Shell Scripting by comparing 2 number