Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: More typeset bugs: POSIX_BUILTINS



2020-11-29 12:18:29 -0800, Bart Schaefer:
> On Sun, Nov 29, 2020 at 12:12 PM Stephane Chazelas
> <stephane@xxxxxxxxxxxx> wrote:
> >
> > FWIW, though I'd agree it's a bug, it's not a POSIX
> > non-compliance as the behaviour for "readonly/export -p var" is
> > unspecified by POSIX, POSIX only specifies "readonly/export -p"
> > without arguments.
> 
> Both bash and ksh ignore -p for readonly/export when there are any
> non-option arguments, and therefore create/assign the named variables.
> 
> So this is at least a ksh emulation incompatibility.

Yes, I had assumed "-p" was for "print", but it looks like it's
more for "POSIX" / "portable" (though neither bash nor zsh give
portable output upon "export -p" when not in posix mode)

With that in mind, it makes more sense now that 
export -p foo
could be expected to do anything else than print the definition
of foo.

Still, I can't see why anyone would write that as the "-p" has
no effect if the intention is to export foo.

While yash and zsh agree on "export -p HOME" printing the
definition of HOME, "export -p HOME=bar" sets HOME to bar
in yash and ignores -p, while in zsh, it prints the current
value of HOME and ignores =bar.

-- 
Stephane




Messages sorted by: Reverse Date, Date, Thread, Author