I hope you have some general knowledge about shell programming. Here I submit of sample code by which you can find maximum among three number.


echo "Enter Number 1:-"
read a

echo "Enter Number 2:-"
read b

echo "Enter Number 3:-"
read c

if [ $a -ge $b ]
then
s=$a
else
s=$b
fi

if [ $s -ge $c ]
then
t=$s
else
t=$c
fi

echo "The maximum among $a,$b,$c is $t"

Write the above code using any editor and run it in terminal. The general instruction of creating or modifying a file in terminal is vi filename then press i write the content and then press capital Z twice. Then run the file using sh command with that file name.
-----------------------------------------------------------------------------------------------------------------------------
Human do error, please email:- webmaster@piyadas-world.com if you find any. Please visit http://www.piyadas-world.com for more resource.

0 comments