Thread: Newbie problem: 'command not found error'
i enter:
#!/bin/bash
echo "average program: enter 10 numbers mean average"
nm2=1
in 1 2 3 4 5 6 7 8 9 10
do
if test "$1" = "noplay"
exit
fi
if test "$1" = "play"
then
echo -e "\nprint enter number $i"
read nm
nm2=$[nm+nm2]
echo -e "\n$nm2 total"
mean=$[nm2/10]
echo "$mean mean"
fi
if test "$mean" -ge "30" | "$mean" -le "50"
then
echo "your mean in between 30 , 50"
elif test "$mean" -gt "100"
then
echo "your mean greater 100"
else
echo "your mean not in between 30 , 50, or greater 100"
fi
done
runs expected error:
./average.sh: line 19: 0: command not found
'0' in error representation of mean - program runs changes mean changes, error equal $mean.
appreciate padwan learner in search of jedi...please ignore dumb nature of program...
you want && in here don't you? want mean greater 30 and less 50.code:if test "$mean" -ge "30" | "$mean" -le "50" echo "your mean in between 30 , 50"
need 'test' before second test, i.e. if test <expr> && test <expr>.
calculation of running mean wrong, i'm going assume that's because haven't been able test properly.
not quite sure understand point of play/noplay argument. if didn't want play, why run program in first place?
ps. please use code tags (see '#' button in posting toolbar). these preserve indentation.code:./average.sh noplay
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk Newbie problem: 'command not found error'
Ubuntu
Comments
Post a Comment