You are not logged in.

#1 2008-12-23 23:34:34

smartboyathome
Member
From: $HOME
Registered: 2007-12-23
Posts: 334
Website

problem with case...

I have been looking at other scripts, they all seem to use case similarly, but I can't figure out why case doesn't like my case statement. Heres an exert from my code, which contains the case statement (ask for the whole thing if you want):

while [ "$#" -ne "0" ]; do
  case $1 in
    --help)
     usage
     exit 0
     ;;
    -h)
     usage
     exit 0
     ;;
    --extra)
     core
     extra
     finalmsg
     exit 0
     ;;
    -e)
     core
     extra
     finalmsg
     exit 0
     ;;
  esac
done

That should just check if I am running using the -h, --help, -e, or --extra flags, but what I get for every one (by using comments to block out the rest):

../e17-svn-builder.sh: line 177: syntax error near unexpected token `;;'
../e17-svn-builder.sh: line 177: `     ;;'

It was working fine yesterday, and I tried commenting out each piece in each group, nothing works. Can someone help? Thanks. smile

Offline

#2 2008-12-24 00:01:27

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: problem with case...

Looks fine, it's probably a while or even a (, or [ that is improperly closed.

You'll have to post the entire script.

Offline

#3 2008-12-24 01:37:27

smartboyathome
Member
From: $HOME
Registered: 2007-12-23
Posts: 334
Website

Re: problem with case...

Thanks, that told me to look over the new additions I made to it, and lo and behold, a missing ). Thanks for mentioning it though, I probably would have never caught it. tongue

Offline

Board footer

Powered by FluxBB