[Techtalk] Help, I'm stumbling on the PATH

Beth Johnson linux.chick at verizon.net
Sun Feb 23 20:54:51 EST 2003


A little help needed here!

RedHat 8.0
I'm trying out a program that uses java; I've installed both the jre and
jsdk rpms (because, what the heck I might dust off my java in 24 hours
book) and I've pointed the application to the jre directory.

What I really need to do is add the java to my PATH.  Sun very helpfully
supplies reams of documentation, and in it shows the helpful env stuff I
can set, including the PATH stuff.  Like, JAVA_HOME=(blah, blah) and
PATH=$PATH:$JAVA_HOME/bin.

However, I look in my /etc/profile and I don't see a simple PATH=, I see
this:

<begin lengthy insert>

# /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

<end lengthy insert>

Okay, I get the part about seeing if the uid is 0 and adding the sbin
stuff for root, but about the rest--yikes!  I don't know any shell
scripting.

Can I just add the java stuff and a PATH statement, say after the USER
but before the export, like this:
PATH=$PATH:$JAVA_HOME/bin
and have that work out all right?  Is that what I'm meant to do?

enquiring minds want to know,
Beth
-- 
  /\/\    Beth Johnson
 / o o\   Cosmic Wonderer
( / ^^\)  Springfield, MA USA
 \ M_M/   "Ruling a country is like cooking a small fish--
           you have to handle it with care."--Lao Tzu
	




More information about the Techtalk mailing list