having some trouble in case statement

Hi All,

I have script which will take the parameter as
PNLYYYYMMDD/PNL
or PNL-AMDYYYYYMMDD/PNL-AMD
now based on YYYYMMDD my script will parse and do some logic within

my case statement looks like below

case `echo $1 | tr '[:upper:]' '[:lower:]'`
in
pnl*) do some logic;;
pnl-amd*) do some logic;;
*);;
esac

now if my script takes the parameter as PNLYYYYMMDD or PNL it works fine
but if I'm passing parameter like pnl-amdYYYYYMMD
then it's taking pnl* case and trying to execute it's logic not the pnl-amd* one.

So how can I instruct case statement to follow pnl-amd logic when I'm passing pnl-amd as parameter???

Try flipping the two case statement entries around. The first case is inclusive of the second, so it will gobble up all "pnl-amd"'s

hey Scrutinizer, I know I need to switch the postion in order to work.
But the logic for each case is a huge one, so I don;t want to make everything goes bad.
So intsead I came up with this one,

case `echo $1 | tr '[:upper:]' '[:lower:]'`
in
pnl[^-]*) do some logic;;
pnl-amd*) do some logic;;
*);;
esac

which is working fine, atleast.....now
Cheers!!