Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: print builtin preceded by parameter assignment
- X-seq: zsh-users 23922
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: <zsh-users@xxxxxxx>
- Subject: Re: print builtin preceded by parameter assignment
- Date: Wed, 10 Apr 2019 14:14:13 +0100
- Cms-type: 201P
- Dkim-filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190410131415euoutp02df80daeb1417b3fdc46fcc04a58bc450~UHy5zn3WJ1022810228euoutp024
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1554902055; bh=TFEBtGbi6pmrYpQALS+t/tmHnmBzDb2L+Lnt8FB3Pvs=; h=Subject:From:To:Date:In-Reply-To:References:From; b=Kz+Z7ZyUPDMjwi3wWK4j4edGl81MiuAyYG4cpFf4whyANDlfhogYp202Sz8fVQ0on DZrkmRg3BfJv+0wwtNjsR9PAdjKU2TxHYOd5QTn/T+WO+cOx14zI8nnX4pFQds92rv KDPC4vEnlfygmEhfhJjoNJU8S3BIshgczy8kFMWE=
- In-reply-to: <20190410125557.GA19114@cventin.lip.ens-lyon.fr>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CGME20190410125753epcas1p4052249a86c562165e1fe2a485d70e70b@epcas1p4.samsung.com> <20190410125557.GA19114@cventin.lip.ens-lyon.fr>
On Wed, 2019-04-10 at 14:55 +0200, Vincent Lefevre wrote:
> It seems that the print builtin doesn't take into account a change
> of the environment with a parameter assignment. For instance:
>
> cventin% zsh -c 'TZ=UTC print -P "%D{%c}"'
> 2019-04-10T14:53:50 CEST
> cventin% zsh -c 'export TZ=UTC; print -P "%D{%c}"'
> 2019-04-10T12:53:53 UTC
>
> Is there any (undocumented?) reason or is this a bug?
It's certainly the case that such assignments only go into the
environment, and aren't processed within the shell.
I *think* this is standard behaviour:
http://pubs.opengroup.org/onlinepubs/9699919799/
2.9.1 specifies that unless the command is a special builtin utility,
the "current execution environment" is not affected by the assignment;
the value is simply exported. I'd certainly assume the time zone seen
by % escapes is part of the current execution environment. Neither
print (obvioussy) nor echo are special builtin utilities.
As this is a standard, I may simply have misread it.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author