Computing.Net > Forums > Linux > extend $PATH

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

extend $PATH

Reply to Message Icon

Name: php
Date: October 3, 2002 at 19:01:08 Pacific
OS: pentium 550
CPU/Ram: 256
Comment:

How do I add a new directory to $PATH? If I do "echo $PATH" I get
/sbin:/usr/sbin:/bin:
/usr/bin:/usr/X11R6/bin:/usr/local/bin:
/usr/local/sbin

I would like to add /usr/local/apache2 to this path, but don't know how. I searched and searched, but can't find a working solution.
I read that one can add the path to /etc/profile or to /root/.bash_profile, but this doesn't seem to work.
I can open the terminal and type:
PATH="$PATH:/usr/local/apache2", but if I close the terminal, the new entry disappers from the path. So how do I add the directory to the path permanently? after all, /sbin:/usr/sbin:/bin:
/usr/bin:/usr/X11R6/bin:/usr/local/bin:
/usr/local/sbin are permanent, I just don't know where these entries are located, so that I would add the new directory
here are my files:

profile:

# /etc/profile -*- Mode: shell-script -*-
# (c) MandrakeSoft, Chmouel Boudjnah

loginsh=1

# Users generally won't see annoyng core files
[ "$UID" = "0" ] && ulimit -S -c 1000000 > /dev/null 2>&1

if ! echo ${PATH} |grep -q /usr/X11R6/bin ; then
PATH="$PATH:/usr/X11R6/bin"
fi

if [ "$UID" -ge 500 ] && ! echo ${PATH} |grep -q /usr/games ; then
export PATH=$PATH:/usr/games
fi

umask 022

USER=`id -un`
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HISTCONTROL=ignoredups
HOSTNAME=`/bin/hostname`
HISTSIZE=1000

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi

# some old programs still use it (eg: "man"), and it is also
# required for level1 compliance for LI18NUX2000
NLSPATH=/usr/share/locale/%l/%N
export PATH PS1 USER LOGNAME MAIL HOSTNAME INPUTRC NLSPATH
export HISTCONTROL HISTSIZE

for i in /etc/profile.d/*.sh ; do
if [ -x $i ]; then
. $i
fi
done

unset i

.bash_profile:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi


mesg n
PATH="$PATH:/usr/local/apache2/bin"



Sponsored Link
Ads by Google

Response Number 1
Name: Lawrence
Date: October 3, 2002 at 19:42:57 Pacific
Reply:

Either in ~/.bashrc or ~/.bash_profile, add
these two lines,

PATH=$PATH:/usr/local/apache2/bin
export PATH

Lawrence


0

Response Number 2
Name: php
Date: October 5, 2002 at 18:53:23 Pacific
Reply:

thanx, it worked. I added the line to .bashrc, logged off/on KDE, and voila-it was part of the $path now.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: extend $PATH

PATH in LINUX www.computing.net/answers/linux/path-in-linux/15580.html

Need help with PATH variable www.computing.net/answers/linux/need-help-with-path-variable/11636.html

Can't start X!!!! www.computing.net/answers/linux/cant-start-x/9673.html