View Single Post
Old 22-05-2006, 10:01 PM   #3 (permalink)
mediator
String Phreak
 
mediator's Avatar
 
Join Date: Mar 2005
Location: In ur Evil Mind!
Posts: 2,457
Default Re: mul. in shell script

Here's a complete shell script dood i made during ma 2nd year !!

********************* Save as shellscript ***********************

#simple division => "`expr $1 / $2`"
if [ -z $1 ] || [ -z $2 ]
then
echo "Two Arguments needed!!";exit
else
echo "Enter Your option"
echo "1) Multipication"
echo "2) Division"
echo "3) Addition"
echo "4) Subtraction"
echo "5) Exit"
while [ 1 ]
do
echo -n "Option : ";read option
case $option in
1)echo "Result = `expr $1 \* $2`";;
2)echo "Result = `echo "$1/$2" | bc -l`";;
3)echo "Result = `expr $1 + $2`";;
4)echo "Result = `expr $1 - $2`";;
5)echo "Ended on : `date`";exit;;
*)echo "Enter one of the given options";;
esac
done
fi

******************* Run as "sh shellscript arg1 arg2" *******************

Problem Solved !!
mediator is offline