Professional Documents
Culture Documents
Shell
Shell
Relational Operators
-eq
-ne
-gt
-lt
-ge
-le
Logical Operators
-a
-o
!
Branching
if .. then .. else .. fi
if [condition]
then
statements
elif
statements
fi
Example
then
hra=`expr $sal / 5`
then
hra=`expr $sal / 4`
then
hra=`expr $sal / 4`
else
hra=`expr $sal / 3`
fi
case .. esac
echo "menu"
read choice
case $choice in
1) pwd;;
2) who;;
*) echo "Invalid choice";;
Loops
for .. do .. done
Example - for .. do .. done
for a in 1 2 3
do
done
while .. do .. done
while true
do
read ch
if [ $ch = Y -o $ch = y ]
then
fi
done
until .. do .. done
until ls abc
do
exit
done