levon
levon

Reputation: 1

Why do I get a syntax error in my bash script?

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?

Upvotes: 0

Views: 731

Answers (2)

regality
regality

Reputation: 6554

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

Upvotes: 6

Michael Krelin - hacker
Michael Krelin - hacker

Reputation: 143259

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

Upvotes: 1

Related Questions