Hi
I not sure what is wrong with my script... when I try to run it I get the follow error: "remove: syntax error at line 77: `end of file' unexpected" Thanks in advance for any help.
ans=y
while [ "$ans" = "y" ]
do
while :
do
echo "Please enter a name that you want to remove /c"
read name
if [ $name" = "" ]
then
echo "You have not enter a name"
echo "Please try again."
continue
else
echo "Searching for $name in the phonebook"
break
fi
done
clear
grep -in "$name" phonebook | sed -n -e 's/^/\
/' -e 's/:/\
/gp'
while :
do
echo "Please enter the record that you want to remove:"
read number
total=`cat phonebook|wc -1`
if [ "$number" != "" ]
then if [ $number -ge 1 -a $number -le $total ]
then
echo "Removing record"
break
else
echo "You did select a vaild record"
echo "Please try again"
continue
fi
else
echo "You didn't enter a record number"
continue
fi
done
sed "$number"d phonebook > phonebook.tmp
mv phonebook.tmp phonebook
echo "Do you want to remove another record? (y/n) \c"
read ans
done
I think it may have to do with my indentation however the script will not paste properly on the board.