Hi Folks,
I am going through a sample script which is not working.
Also i want to understand the certain syntaxes
#!/bin/sh
clear
x="y"
echo "enter ur 1st no."
read n1
echo "enter ur 2nd no."
read n2
while [ $x = "y" ]
do
clear
echo "1.sum"
echo "2.subtraction"
echo "3.product"
echo "4.quotient"
echo "5.exit"
echo -n "Enetr ur choice between [1-5]"
read ch;
case $ch in
1) sum = `expr $n1 + $n2`
echo "the sum of two nos. provided by u is $sum";;
2) subtraction = `expr $n1 - $n2`
echo "the remainder after subtrating the smaller value from bigger one is $subtraction";;
3) product = `expr $n1 \* $n2`
echo "The product of 2 nos. is " $product;;
4)quotient = `expr $n1 / $n2`
echo "the quotient of two nos. is" $quotient;;
5) exit
echo "by-2" $USERNAME
esac
done
Code is working fine till.Why i am getting No such file or directory message.
enter ur 1st no.
3
enter ur 2nd no.
4
1.sum
2.subtraction
3.product
4.quotient
5.exit
-n Enetr ur choice between [1-5]
1
sum: = No such file or directory
sum: 7 No such file or directory
the sum of two nos. provided by u is
1.sum
2.subtraction
3.product
4.quotient
5.exit
-n Enetr ur choice between [1-5]
5
What is the meaning of
1.x="y"
2.read n1
3.esac