You are on page 1of 17

PRACTICAL-2

BASICS OF SHELL SCRIPT


Creating a Shell script
Type vim test1.sh

Press Insert and type the following command

echo “hello”

Save the file by pressing esc and then :wq

Execute the shell script

Type sh test.sh

Press Enter
Defining Variable and Getting user input
a=10

echo $a

User input

echo “enter the name”

read name

echo $name
ARITHMETIC OPERATORS
RELATIONAL OPERATORS
BOOLEAN OPERATOR
STRING OPERATORS
Decision making statement : if
Until
While loop
For loop
Loop with continue statement
Switch case statement
Switch case statement

Esac
File test operators
File test operators
File test operators

You might also like