square root problems - script
Hello there,
I wrote that script with abit of help in the lines commented
I get an error that I can not fix.
Could somebody help ?
#!/bin/bash
RANDOM=$$
let a=`expr $RANDOM % 10`
let b=`expr $RANDOM % 10`
let c=`expr $RANDOM % 10`
echo "A is equal to: "$a
echo "B is equal to: "$b
echo "C is equal to: "$c
d=$(($b*$b-4*$a*$c))
echo "The D is eqaul to: "$d
if (($d>0))
then
z=`echo "sqrt ($b*b-4*$a*$c)" | bc -l`
one=`echo $z | cut -d"+" -f #HERE
two=`echo $z | cut -d"-" -f #HERE
echo "+ Number is equal to: "$one
echo "- Number is eqaul to: "$two
else
./sqrt.txt
fi
Thanks alot,
Later
|