Subject: Re: ksh patterns
To: matthew sporleder <msporleder@gmail.com>
From: dieter roelants <dieter.NetBSD@pandora.be>
List: netbsd-users
Date: 09/19/2007 23:05:18
On Wed, 19 Sep 2007 15:37:32 -0400
"matthew sporleder" <msporleder@gmail.com> wrote:

> ksh is interpreting the | literally.  This works:
> foopattern="foo"
> barpattern="bar"
> bazpattern="baz"
> for file in foo bar baz;
> do
>  case $file in
>   "${foopattern}") echo foo
>    ;;
>   "${barpattern}"|"${bazpattern}") echo bar
>    ;;
>   *) echo default
>    ;;
>  esac
> done
> 
> However, that does not follow the man page:
> "Both the word and the patterns are subject to parameter, command, and
>  arithmetic substitution as well as tilde substitution."

Yes it does. You misinterpret the meaning of "patterns" here. If you
look at the synopsis of case, you see that the '|' isn't part of a
pattern, it separates multiple of them.

Kind regards
dieter