F= `expr $E/$S`
output
test5.sh: line 45: 1296863.27001857757568359375/21997: No such file or directory
can any one help me ,i just want to divide the $E/$S and Print o/p in F.
F= `expr $E/$S`
output
test5.sh: line 45: 1296863.27001857757568359375/21997: No such file or directory
can any one help me ,i just want to divide the $E/$S and Print o/p in F.
Try again leaving spaces around the /
.
When dealing with non-integer numbers I'd recommend to use bc
instead of expr.
$ E=1296863.27001857757568359375
$ S=21997
$ F=$(echo "$E / $S" |bc)
$ echo $F
58
$ F=$(echo "scale=20; $E / $S" |bc)
$ echo $F
58.95636996038448768848
You can use
Integer
F=$(($E/$S))
Non integer
F=$(echo $E $S | awk '{print $1/$2}')
58.9564