I am trying to get this script to function correctly but I get ./passmark.sh line 7: [y command not found
.
Here is my script
#!/bin/bash
# A simple script to ask a user for a pass mark and then display a grade
# the grade will be either an A, B, C, D or F
#
CONT=y
echo
while [$CONT = "y" ]
do
echo -e "\"Please enter a pass mark: \c \""
read MARK
if [$MARK -ge "0" -a $MARK -lt "50"] ; then
echo -e "\n \"F\" \n"
elif [$MARK -ge "50" -a $MARK -lt "60"] ; then
echo -e "\n \"D\" \n"
elif [$MARK -ge "60" -a $MARK -lt "70"] ; then
echo -e "\n \"C\" \n"
elif [$MARK -ge "70" -a $MARK -lt "80"] ; then
echo -e "\n \"B\" \n"
elif [$MARK -ge "80" -a $MARK -lt "100"] ; then
echo -e "\n \"A\" \n"
else
echo -e "\"Invalid input!!\n \""
fi
echo -e "\"Would you like to enter another pass mark? (y/n) \c \""
read REPLY
case "$REPLY" in
n | N | no | No | NO ) CONT=n ;;
*) ;;
esac
echo
done
/bin/bash -x ./script
to have bash show you what it's parsing as it runs. What it tried will have a+
in front of it, followed by any output. If you see an error, it's the line above. That's just for general guidance, the answer by Barmar is the cause of the error you're getting. – Tim Post Oct 16 '14 at 22:58