What is Kernel ?

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 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 #!/bin/bash?

#!/bin/bash' is known as the shebang, A hash (#) and an exclamation mark (!) is basically instructs the operating system to use Bash as a default shell to run the script

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

  1. Create one file .sh

  2. #!/usr/bin/env bash

    read name

    echo "Hello, $name"

  3. chmod +x input.sh

  4. ./input.sh

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

#!/usr/bin/env bash

read num1

read num2

if [ $num1 -lt $num2 ]

then

echo "a is less than b"

else

echo "a is greater than b"

fi