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

Re: print builtin preceded by parameter assignment



On 2019-04-10 15:39:46 +0100, Peter Stephenson wrote:
> On Wed, 2019-04-10 at 16:11 +0200, Vincent Lefevre wrote:
> > 1. If the command name is not a special built-in utility or function,
> > the variable assignments shall be exported for the execution environment
> > of the command [...]
> > 
> > In this case, the variable assignments should affect the output.
> 
> I see how you're interpreting this --- the "execution environment of the
> command" is anything the command happens to do, not just what the
> environment itself would show, while "the current execution
> environment", which explicitly isn't affected by a bit you didn't quote
> and which I assumed included "print" as it is part of the current
> execution environment, to you is just what happens after the command
> finishes.

Yes, for instance, I would have assumed the following to be similar:

cventin% zsh -c 'TZ=UTC print -P "%D{%c}"'
2019-04-11T12:41:37 CEST
cventin% zsh -c 'p() { print -P "%D{%c}" } ; TZ=UTC p'
2019-04-11T10:41:41 UTC

I don't see any reason why the current execution environment would
have a different meaning in the first case.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



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