On Fri, 26 Aug 2005, Otto Moerbeek wrote:

> On Fri, 12 Aug 2005, Dave Anderson wrote:
> 
> > ** Reply to message from Otto Moerbeek <[EMAIL PROTECTED]> on Wed, 10 Aug
> > 2005 21:18:09 +0200 (CEST)
> > 
> > >I took some time to look into this.  After some head scratching and
> > >staring at code, I tested this behaviour using both the '88 and '93
> > >versions the AT&T version of ksh on Solaris.  They both have exactly
> > >the same behaviour.  So very likely this is not a bug. 
> > >
> > >Both the Kornshell book by Bolsky and Korn (i have the edition
> > >describing the '88 version of ksh) and the Solaris manual pages are
> > >not very clear on the exact semantics of pattern expansion.  From the
> > >observed behaviour and the pdksh code it seems that the x(...)
> > >pathnames expansions are not done if the pattern is a result of an
> > >earlier expansion, only ?, * and [...] expansions are done in that
> > >case.
> > >
> > >Since in the test program the first step is expansion of $1, only
> > >basic pathname expansion is on the result of that expansion.
> > 
> > Thanks for taking the time to research this.  It sounds like the sh(1)
> > manpage should be updated to capture this information.  In my recent
> > "adventures in shell scripting" I've found a few other glitches in that
> > page; it may take a little while, but I'll post an intelligible set of
> > notes here on what I've found.
> 
> Just to let you know that I did not forget about this. I have been on
> vacation. I will come up with something the coming days.

Sigh, this is all a bit more complex than I previously thought.
AFAIK ksh88 and pdksh never expands the x(...) construct if the
string is the result of an earlier expansion. ksh93 though, does
behave different in this case (and probably in similar cases too)

        p="*(a|b)"
        [[ a == $p ]] && echo OK

ksh93 prints OK, while ksh88 and pdksh do not.

The manual pages at www.kornshell.com are awfully silent on the
details of this.

If you enable extglob in bash, it both expands $1 in the original
testcase (t1), and it prints OK in the above case (t2). So we have

   pdksh ksh88 ksh93 bash
t1     N     N     N    Y
t2     N     N     Y    Y

I'm really wondering if I should document the current behaviour as a
ksh88 compatible behaviour or a bug. 

        -Otto

Reply via email to