Skip to content
Advertisement

how to avoid enviroment variable from resetting in WSL terminal after restart?

environment variable set (in zsh shell) in WSL disappears after restarting the terminal. I have used

export variable_name=variable_value

to set environment variable. how should I avoid env variable from resetting after restart.

Advertisement

Answer

I added environment variable in .zshrc file after reading comment of @Biswapriyo. like this- export variable_name=variable_value and now it works.

I think, at every startup, scripts in .zshrc file are ran so this env variable is addded. If you use bash instead of zsh then you may try adding this in .bashrc file or any other rc file.

You can check if env variable is added or not by printenv

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement