I would like to break cat with the command 'break'. Pretty hard to understand huh? So to clarify it:
echo "If you want to stop adding datas to your telephonebook please type 'break'
if [ $name = break ] #this part is probably not good
then
echo "the program is shutting down..."
#missing commands
else
cat $name[tab]$telephonenumber >> telephonebook.txt
fi
Well no wonder...i get a syntax error. I think the first problem is with the $name = break part... i just don't know how to fix it.
And my second question would be: how can i pause the screen for a few seconds, so the user can read the text ("the program is shutting down..."), and how can i break the running program.
Thanks in advance, cheers:
buddhist
IMHO you have misunderstood the assignment. Time to talk to your tutor. As scrutinizer hints, "break" is a unix shell command. It has other meanings too.
An example use of "break" in a shell script would be:
while true
do
echo "To finish press return"
echo "Enter name" ; read name
if [ "${name}""X" = "X" ]
then
echo "the program is shutting down..."
break # Exit the while loop
fi
echo "Enter telephone number" ; read telephonenumber
echo "${name} ${telephonenumber}" >> telephonebook.txt
done
BTW. It is much more complicated to react to a user pressing the key marked "break" on an IBM 102 key keyboard.