zsh-users
 help / color / mirror / code / Atom feed
* set temporary environment variables for builtins
@ 2023-12-16 17:59 Clinton Bunch
  2023-12-16 18:53 ` Lawrence Velázquez
  0 siblings, 1 reply; 11+ messages in thread
From: Clinton Bunch @ 2023-12-16 17:59 UTC (permalink / raw)
  To: zsh-users

I was playing around with date formats using print -P and tried to get 
the time in Paris.

This didn't work:

TZ=Europe/Paris print -P '%D{%Y%m%dT%H%M%S%z}'

This does:

export TZ=Europe/Paris

print -P '%D{%Y%m%dT%H%M%S%z}'


but I have to unset/restore TZ afterwards.


I also tried:

() { typeset -x TZ=Europe/Paris; print -P '%D{%Y%m%dT%H%M%S%z}' }

It left me with TZ set.

I know this can be done with the date command, but it's one of those 
things that went from "Let's try this" to "Surely, there's a way to do this"

Is this a bug or design decision?

echo $ZSH_VERSION $ZSH_PATCHLEVEL $OSTYPE
5.8 zsh-5.8-0-g77d203f linux-gnu

cat /etc/system-release
Rocky Linux release 9.3 (Blue Onyx)



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-12-17 11:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-16 17:59 set temporary environment variables for builtins Clinton Bunch
2023-12-16 18:53 ` Lawrence Velázquez
2023-12-16 19:48   ` Clinton Bunch
2023-12-16 20:20     ` Bart Schaefer
2023-12-16 20:21     ` Lawrence Velázquez
2023-12-16 20:27       ` Bart Schaefer
2023-12-16 20:31         ` Roman Perepelitsa
2023-12-16 20:35           ` Bart Schaefer
2023-12-16 23:53           ` Mikael Magnusson
2023-12-17  0:26         ` Lawrence Velázquez
2023-12-17  7:54           ` Roman Perepelitsa

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).