From my point of view, the best way is to add the following lines at the ~/.zshrc
file (if you don't already have it, then create it):
if [ -d "/path/to/jdk" ] ; then
export PATH="/path/to/jdk/bin:$PATH"
fi
Then restart your zsh
, or just run source ~/.zshrc
and then your PATH should be exactly as you wish.
Or, if you want to make the change to be system-wide, then add the previous code to the end of /etc/zsh/zshenv
file.
But in any case do not use /etc/profile.d
to automatically run scripts in zsh
. This directory is useful only for the bash
shell, not zsh
as in your case. To understand this, open /etc/profile
file, which is a bash initialization file and in no case a zsh initialization file, and you will see somewhere at the end of the file:
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
So, your scripts from /etc/profile.d
directory will automatically run in zsh
only if you add the previous code in a zsh initialization file, like /etc/zsh/zprofile
for example, or source /etc/profile
in /etc/zsh/zprofile
file.
The example in the wiki, for setting session variables via ~/.pam_environment
, states in a note:
The syntax used for modifying PATH, which syntax differs from script files, is required for variable expansion to work.
Hence your first row should look like:
ANDROID_HOME DEFAULT=${HOME}/Android/Sdk
Best Answer
As others already wrote Ubuntu doesn't set the
MANPATH
by default. You can edit your.profile
and add theMANPATH
as you like. But where does Ubuntu get the information about your manpath?This information is set in
/etc/manpath.config
. The packageman-db
uses this information to configure the paths for man. The environment variableMANPATH
has precedence over the filemanpath.config
. The file has the following (and probably more) entries:The first line tells a software which automatically generates the
MANPATH
what directories it should contain. Typically/usr/man
,/usr/share/man
and other are set up here.Next is a mapping from the users
PATH
to the correctMANPATH
. If a user has/usr/bin
in hisPATH
, theMANPATH
should contain/usr/man
in my above example.The
DEFINE
value has some default set of arguments and programs for pager utilities.