This is irritating me. I seen several suggestions (all using different files and syntax) and none of them worked.
How do I set an environment variable for a specific user? I am on debian squeeze.
What is the exact syntax I should put in the file to make ABC = "123"?
Best Answer
You have to put the declaration in the initialization files of your shell:
If you are using bash, ash, ksh or some other Bourne-style shell, you can add
in your
.profile
file (${HOME}/.profile
). This is the default situation on most Unix installations, and in particular on Debian.If your login shell is bash, you can use
.bash_profile
(${HOME}/.bash_profile
) or.bash_login
instead.Note: If either of these files exists and your login shell is bash,
.profile
is not read when you log in over ssh or on a text console, but it might still be read instead of.bash_profile
if you log in from the GUI. Also, if there is no.bash_profile
, then use.bashrc
.If you've set zsh as your login shell, use
~/.zprofile
instead of~/.profile
.If you are using tcsh, add
in
.login
file (${HOME}/.login
)if you are using another shell look at the shell manual how to define environment variables and which files are executed at the shell startup.