Adding to the $PATH
Hello,
I would like to add to the system wide $PATH in red hat 9. Which file should I edit to achive this? Examples would be appreciated! Thanks, Chris. |
In Slack it's /etc/profile - that much *should* be the same in RH.
|
ok my /etc/profile
looks like this:- ------------------------------------- # /etc/profile # System wide environment and startup programs, for login setup # Functions and aliases go in /etc/bashrc pathmunge () { if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then if [ "$2" = "after" ] ; then PATH=$PATH:$1 else PATH=$1:$PATH fi fi } # Path manipulation if [ `id -u` = 0 ]; then pathmunge /sbin pathmunge /usr/sbin pathmunge /usr/local/sbin fi pathmunge /usr/X11R6/bin after unset pathmunge # No core files by default ulimit -S -c 0 > /dev/null 2>&1 USER="`id -un`" LOGNAME=$USER MAIL="/var/spool/mail/$USER" HOSTNAME=`/bin/hostname` HISTSIZE=1000 if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then INPUTRC=/etc/inputrc fi export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC for i in /etc/profile.d/*.sh ; do if [ -r "$i" ]; then . $i fi done unset i --------------------------------------- Where and how would I place additions to the system wide $PATH into the above /etc/profile ? Thanks, Chris |
Quote:
example: Code:
export PATH=$PATH:/usr/games adding to /etc/profile the next Code:
if ! echo ${PATH} |grep -q /usr/games ; then Take a look at /etc/profile, you maybe have more clues there... Regards |
There are many directories in my $PATH:-
bash: /usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/bo1cps/bin: No such file or directory Some of these do not appear in the /etc/profile Where are these directories coming from? Would it be ok to add:- if ! echo ${PATH} |grep -q /usr/games ; then PATH="$PATH:/usr/games" fi anywhere in the /etc/profile ? Thanks, Chris. |
Quote:
Code:
# /etc/profile -*- Mode: shell-script -*- |
Quote:
Yeesh. RH scripts are ugly. ;) |
Quote:
|
........... or more simply (for example)
PATH=$PATH:/home/john/programs export PATH If you now check your PATH with echo $PATH you'll see the new directory at the end of the colon separated list of directories in your PATH variable. |
All times are GMT -5. The time now is 10:44 PM. |