Click to See Complete Forum and Search --> : whats wrong with this script?


circleW
09-28-2004, 05:39 PM
does anyone know what is wrong with this shell script? i just started working with unix, so please bear with me


assignment3: $*

if (($# == 3))
then
echo " ";echo "There are $# people to find out about.";echo " ";
echo "Enter hair color, eye color, and age for $1:\n\c"
read HAIR EYE AGE
echo "Enter hair color, eye color, and age for $2:\n\c:
read HAIR2 EYE2 AGE2
echo "Enter hair color, eye color, and age for $3:\n\c:
read HAIR3 EYE3 AGE3
echo " "
else
echo "You must enter 3 names"
fi
if (($AGE > $AGE1) && ($AGE > $AGE2))
then
echo " "; echo "At $AGE years old, $1 is the oldest person in the list."
elif (($AGE2 > $AGE) && (AGE2 > $AGE3))
then
echo " "; echo "At $AGE2 years old, $2 is the oldest person in the list."
elif (($AGE3 > $AGE) && (AGE3 > $AGE2))
then
echo " "; echo "At $AGE3 years old, $3 is the oldest person in the list."
fi

NogDog
09-29-2004, 12:49 AM
Assuming this is Bourne shell, try launching it this way:

sh -x script_name arg1 arg2 ... argn

This should at least give you an idea at which line your getting unexpected results.

Hope that helps.