Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unset environment variable after temporary assignment #1448

Closed
hanche opened this issue Dec 11, 2021 · 0 comments · Fixed by #1551
Closed

Unset environment variable after temporary assignment #1448

hanche opened this issue Dec 11, 2021 · 0 comments · Fixed by #1551

Comments

@hanche
Copy link
Contributor

hanche commented Dec 11, 2021

After temporary assignment to an environment variable, that variable should be unset after the function exit, provided it was unset before. Consider this (using the new tmp syntax):

⬥ date; has-env TZ; { tmp E:TZ = UTC; date }; date; has-env TZ; put $E:TZ
Sat Dec 11 10:07:40 CET 2021
⮕ $false
Sat Dec 11 09:07:40 UTC 2021
Sat Dec 11 09:07:40 UTC 2021
⮕ $true
⮕ ''

As can be seen from the various date outputs, it does make a difference whether an environment variable is unset or merely empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant