write a shell program check even or odd:
echo "ENter a number:"
read n
if [ `expr $n % 2` -eq 0 ]
then
echo $n is even
else
echo $n is odd
fi
-eq - equal to
-le less than equal to
-ge greater than equal to
-gt greater than
*** if else syntax ***
if command is successful
then
execute commnads
else
execute commands
fi
if command is successful
then
execute commads
fi
if command is successful
then
execute commands
elif commands is successful
then ...
elif ...
then...
fi
*** switch case ***
case expression in
pattern1) commands1 ;;
pattern2) commands2 ;;
....
....
....
esac
*** while loop ***
while condition is true
do commands
done
*** for loop ***
for variable in list
do
commands
done
*** write a menu based shell program ***
for the following list of
files of proccess of users todays date user of system
*** whether number is prime number ***