There are at least five syntactical mistakes in this program
There are at least five syntactical mistakes in this program. Locate them. (Specify the mistake and its line number. Line numbers are shown on left.)
1 ppprunning yes 2 while Sppprunning yes do 3 echo INTERNET MENUVn 4 1. Dial out 5 2. Exit Choice 7 read choice case choice in 9 1) if -z \"Sppprunning 1 10 echo \"Enter your username and password 11 else 12 Chat sh 13 endif 14 ppprunning-no 15 end case 16 doneSolution
There are 8 mistakes in the given code.
1. Line 1 - Spaces not permitted around =.
2. Line 2 - test operators [] missing in while’s control command.
3. Line 6 - quotes not closed with echo.
4. Line 8 - $ missing in choice.
5. Line 9 - ; is missing.
6. Line 13 - fi required instead of endif.
7. Line 13 - ;; is required instead of ;
8. Line 15 - esac required instead of endcase.
The correct code is shown as below.
ppprunning=yes
while [ $ppprunning = yes ] ; do
echo -e “ Internet Menu\
1. Dial out
2. Exit
Choice:”
read choice
case $choice in
1) if [ -x “$ppprunning” ] ; then
echo “Enter your username and password”
else
chat.sh
fi ;;
*) ppprunning=no
esac
done
