To write a shell program for finding greatest among three numbers.
• Get the three numbers to find the biggest number.
• Check if A is greater than B and C.
• if true print A as greater number if not b > c.
• if B > C print B is greater or C is greater.
• Terminate the program.
PROGRAM SOURCE CODE
echo ”enter 3 numbers”
if [$a –eq $b –a $a –eq $c]
echo “3 number are equal”
elif [$a –gt $b –a $a –gt $c]
echo ”$a is the greatest number”
elif [$b –gt $c]
echo “$b is the greatest number”
echo “$c is the greatest number”
Thus the shell program to find the greatest among three values is written and executed successfully.