0

Here is the script I have been trying:

#!/bin/bash
    case “$1” in 

    [0-9][A-Z])
    echo “ <<Usage: $0 >> Script5.rc argb  ”
    ;;

./Script.rc

But when I run it, I get the following error:

syntax error near unexpected token

What am I doing wrong here?

2
  • What's the deal with those crazy quotes? Commented Nov 21, 2011 at 8:45
  • @sarnold : yes, crazy quotes, good catch! That could do it. Commented Nov 21, 2011 at 12:05

2 Answers 2

6

Two problems:

1) Those are unicode quotes. Those can eff up a script. Do not write code in microsoft word.

2) You forgot to end your case.

case "$1" in  

[0-9][A-Z])
  echo " <<Usage: $0 >> Script5.rc argb  "
  ;;  
esac
Sign up to request clarification or add additional context in comments.

2 Comments

+1, I liked the "do not write code in microsoft word" commandment ;-)
Wordpress tends to mess up quotes too. Do not copy code from random blogs. ;)
1

case is supposed to end with esac. So, at the very least your code sample is incomplete.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.