Subject: Re: brace expansion and ksh?
To: Jeremy C. Reed <reed@reedmedia.net>
From: Chavdar Ivanov <ci4ic4@gmail.com>
List: netbsd-help
Date: 10/12/2007 01:45:20
On 11/10/2007, Jeremy C. Reed <reed@reedmedia.net> wrote:
> I though ksh didn't have brace expansion. But today I was reading the man
> page and it was documented with an example.
>
> But the example does not work:
>
> $ ksh
> $ echo a{c,b{X,Y},d}e
> a{c,b{X,Y},d}e
> $ bash
> bash-3.2$ echo a{c,b{X,Y},d}e
> ace abXe abYe ade
>
> Even simple example in ksh doesn't work for me:
>
> $ echo a{b,c,d,e}f
> a{b,c,d,e}f

But see here:

$ exec ksh
$ echo a{c,b{X,Y},d}e
a{c,b{X,Y},d}e
$ exec ksh93
$ echo a{c,b{X,Y},d}e
ace abXe abYe ade

(the latter being of course the *real* thing - ast-ksh).

>
> Now I see man page says in different section:
>
>         Once brace expansion has been performed, the shell replaces file
>         name patterns with the sorted names of all the files that match
>         the pattern (if no files match, the word is left unchanged).
>
> But that doesn't seem to work either in ksh:
>
> $ echo {D,M}*
> {D,M}*
> $ bash
> bash-3.2$ echo {D,M}*
> DESCR MESSAGE Makefile Makefile.common
>
>
> What is correct behaviour for ksh?

AFAIU /bin/ksh is pdksh or thereabouts.

>
>
>   Jeremy C. Reed
>
Chavdar Ivanov