Day 4: 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 bash?

Bash is a type of shell and shell is used to interact with the kernel. whatever commands il write in a bash shell, will communicate with kernel and give output.

What is Shell

A shell is a gateway/Interface to your Linux kernel. To interact with a kernel you need a shell. It is just like a media, through which a user can interact with the Operating system.

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 a user 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.

What is Shell Scripting for DevOps?

The shell script is a set of commands which are used along with the interpreter (the script is powered by something) which can be /bin/bash or /bin/sh or /zsh.

Shell scripting is just like a movie script where a set of dialogues are used along with sponsors and a production house. Shell scripts will be identified with the .sh extension.

Difference between /bin/bash and /bin/sh?

/bin/sh is a bourne shell whereas /bin/bash is a bourne again shell. it is said that /bash is a replacement for/sh.

Today, Bash is the default programming language for the shells in Linux

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

#!/bin/bash is known as shebang. It is used to identify which interpreterto use to run the code in the file. If you run a script with bash the output would be way simpler and you can easily identify error messages in the case of syntax error. You can simply save time by using bash.

Yes we can write #!/bin/sh as well. The system shell is kind of the default shell that system scripts should use but nowadays, /bash is more commonly used as bash does provide several optional features that weren't available in the original Bourne shell or the POSIX standard.

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

Note: I have given 755 permission to all of my scripts.

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 numbers.

\===========================

Will appreciate your feedback :)

#90daysofdevops

https://www.linkedin.com/in/sweety-samya-963859130

Happy learning!-