how to solve error in shell scripting

  • the_1
  • Newbie
  • Newbie
  • the_1
  • Posts: 13

Post 3+ Months Ago

hello all, i am newbie for linux.
i am using CentOS 5.

i have problem with my shell scripting.
its runtime error.
Code: [ Select ]
#!/bin/sh
#
#Script to test for loop
#
clear
if [ $# -eq 0 ]
then
echo "Error - Number missing form command line argument"
echo "Syntax : $0 number"
echo "Use to print multiplication table for given number"
exit 1
fi
n=$1
for i in 1 2 3 4 5 6 7 8 9 10
do
echo "$n * $i = `expr $i \* $n`"
done
  1. #!/bin/sh
  2. #
  3. #Script to test for loop
  4. #
  5. clear
  6. if [ $# -eq 0 ]
  7. then
  8. echo "Error - Number missing form command line argument"
  9. echo "Syntax : $0 number"
  10. echo "Use to print multiplication table for given number"
  11. exit 1
  12. fi
  13. n=$1
  14. for i in 1 2 3 4 5 6 7 8 9 10
  15. do
  16. echo "$n * $i = `expr $i \* $n`"
  17. done


i am getting error as follows ::
Quote:
line 16: unexpected EOF while looking for matching
line 18: syntax error : unexpected end of file


can anyone please help me to solve it..
thanks to you all in advanced...!!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • the_1
  • Newbie
  • Newbie
  • the_1
  • Posts: 13

Post 3+ Months Ago

hello all problem is solved..

as a newbie i wasnt aware how to save file after writing in cat > filename.
i have saved file using ctrl-D and the problem solved.

cheers to all...

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 80 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.