I have a folder in /data/scripts that I want to set as my path.
I tried export path=$path:/data/scripts
The first time it worked, so figured perfect, so I added it to my rc.local file... but suddently the command itself stopped working. I rebooted the server, and it did not take affect, so I typed it manually, it did not take affect.
So is there a different way of doing it that's consistant?
Archived topic from Anythingforums, old topic ID:1116, old post ID:14046
change path permanently
- Red Squirrel
- Posts: 29209
- Joined: Wed Dec 18, 2002 12:14 am
- Location: Northern Ontario
- Contact:
change path permanently
Honk if you love Jesus, text if you want to meet Him!
change path permanently
use pathmunge in /etc/profile
here's an example of setting java's directory and intel's c++ compiler into the path using pathmunge.
Archived topic from Anythingforums, old topic ID:1116, old post ID:14541
here's an example of setting java's directory and intel's c++ compiler into the path using pathmunge.
Code: Select all
# /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
JAVA_HOME=/usr/java/j2sdk1.4.2_02
pathmunge $JAVA_HOME/bin after
export JAVA_HOME
ICC_HOME=/usr/local/intel/compiler70/ia32
pathmunge $ICC_HOME/bin after
export ICC_HOME
KOMODO_HOME=/usr/local/Komodo-2.5
pathmunge $KOMODO_HOME after
export KOMODO_HOME
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
Resistance is futile...
Registered Linux User #321628
Anime/Toon Avatars
Other Cool Forums
"Never hold your farts in. They travel up your spine, into your brain, and that's where you get s**tty ideas from..." - Woyaya - January 10, 2004
- Red Squirrel
- Posts: 29209
- Joined: Wed Dec 18, 2002 12:14 am
- Location: Northern Ontario
- Contact:
change path permanently
holy crap did not know it would be that complicated. mind explaining that line by line or pointing me to a resource, I don't even know where I would put the actual path in that code...
Archived topic from Anythingforums, old topic ID:1116, old post ID:14578
Archived topic from Anythingforums, old topic ID:1116, old post ID:14578
Honk if you love Jesus, text if you want to meet Him!
change path permanently
all you really need is the pathmunge line. if you want to create an environment variable use this block of code.
the first line creates an environment variable called JAVA_HOME and sets its value to /usr/java/j2sdk1.4.2_02
the second line, puts the path at the end of your existing list of paths.
the third line exports the variable for use.
i think you can just get away with the second line.
ex. --> pathmunge /data/scripts after
put that line after root's path is set (the if/fi block starting with the comment "Path Manipulation") but before the "unset pathmunge" line.
Archived topic from Anythingforums, old topic ID:1116, old post ID:14626
Code: Select all
JAVA_HOME=/usr/java/j2sdk1.4.2_02
pathmunge $JAVA_HOME/bin after
export JAVA_HOME
the second line, puts the path at the end of your existing list of paths.
the third line exports the variable for use.
i think you can just get away with the second line.
ex. --> pathmunge /data/scripts after
put that line after root's path is set (the if/fi block starting with the comment "Path Manipulation") but before the "unset pathmunge" line.
Archived topic from Anythingforums, old topic ID:1116, old post ID:14626
Resistance is futile...
Registered Linux User #321628
Anime/Toon Avatars
Other Cool Forums
"Never hold your farts in. They travel up your spine, into your brain, and that's where you get s**tty ideas from..." - Woyaya - January 10, 2004
- Red Squirrel
- Posts: 29209
- Joined: Wed Dec 18, 2002 12:14 am
- Location: Northern Ontario
- Contact:
change path permanently
Finally got it working, thanks!
Archived topic from Anythingforums, old topic ID:1116, old post ID:14636
Archived topic from Anythingforums, old topic ID:1116, old post ID:14636
Honk if you love Jesus, text if you want to meet Him!