[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: weird ksh eval behavior
From: |
Otto Moerbeek |
Subject: |
Re: weird ksh eval behavior |
Date: |
Thu, 1 Dec 2005 23:17:01 +0100 (CET) |
On Thu, 1 Dec 2005, Matthias Kilian wrote:
> On Thu, Dec 01, 2005 at 08:43:31PM +0100, Ralf Wildenhues wrote:
> > With ash-0.3.8, OpenBSD 3.8 'sh' and 'ksh' PD KSH v5.2.14 99/07/13.2,
> > I get
> >
> > $ false; eval 'foo=$?'; echo $foo
> > 0
> >
> > Is this a shell bug, or am I doing something wrong?
>
> If POSIX mode is enabled by using `set -o posix' or setting
> POSIXLY_CORRECT, the above command line results in a `1'.
>
> eval's mentioned in pdksh's manpage (section `POSIX mode'), but
> that relates to the exit status of eval. I'm not sure wether it's
> a documentation bug. Quoting ksh(1):
>
> eval exit status. If eval gets to see an empty command (i.e.
> eval `false`), its exit status in POSIX mode will be 0. In
> non-POSIX mode, it will be the exit status of the last command
> substitution that was done in the processing of the arguments to
> eval (or 0 if there were no command substitutions).
>
> Ciao,
> Kili
I think this is a bug in pdksh. It's a coincidence the posix flag has
the correct behaviour.
-Otto