Hey guys ..
I am pretty new to Shell Scripting. I was hoping if some one could help me out with my problem.
I am going with a tutorial for shell scripting. While executing some of the programs and commands I am getting errors. I have also checked other sites and tutorials for the same, but everything seems intact.
Following is the code. When I execute this (after changing the permission - 755), I get an error saying "unexpected end of file", Now I am not sure why this is happening ... please help me out.
Thanks in advance
Regards,
A Kris
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
help_uni()
{
echo "Usage: $0 -n -a -s -w -d"
echo "Option: These are optional argument"
echo " -n name of animal"
echo " -a age of animal"
echo " -s sex of animal"
echo " -w weight of animal"
echo " -d demo values (if any of the above options are used"
echo " their values are not taken)"
exit 1
}
if [ $# -it 10];then`
help_ani
fi
while getopts n:a:s:W:d opt
do
case "$opt" in
n) na ="$OPTARG";;
a) age ="$OPTARG";;
s) sex ="OPTARG";;
w) weight ="$OPTARG";;
d) isdef = 1;;
\?) help_ani;;
esac
done
if[ $isdef -eq 0];then`
echo "Animal Name is $na, age is $age, sex is $sex, weight is $weight (user defined mode)"
else''
na = "pluto dog"
age = 3
sex = male
weight = 20kg
echo "Animal name is $na, age is $age, sex is $sex, weight is $weight (demo mode)"
exit 1
fi''
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%