LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-10-2005, 05:50 PM   #1
apocolpse
Member
 
Registered: Oct 2004
Distribution: Fedora Core 4
Posts: 91

Rep: Reputation: 15
$PATH duplicate set issue


This is a small issue but it has been boggling my mind for some time now. I'm running fedora core 3, gnome 2.8. When i echo my path i get /usr/lib/java-1.5.0/bin:/usr/lib/jvm/bin:/usr/kerberos/bin:/usr/lib/java-1.5.0/bin:/usr/lib/jvm/bin:.... etc

if you notice i have my java VM and SDK set twice When i initially setup thhe jdk i work this script

# JRE SETTINGS
export J2RE_HOME=/usr/lib/jvm
export PATH=$J2RE_HOME/bin:$PATH

#JDK SETTINGS
export JDK_HOME=/usr/lib/java-1.5.0
export PATH=$JDK_HOME/bin:$PATH

As far as i can see i only set the path once for each. I've been searching all over and cant seem to find out why this is. Can someone please help me ???
 
Old 06-10-2005, 05:59 PM   #2
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
What's the rest of that section of your /etc/profile (or .bashrc) file look like?
 
Old 06-10-2005, 06:18 PM   #3
apocolpse
Member
 
Registered: Oct 2004
Distribution: Fedora Core 4
Posts: 91

Original Poster
Rep: Reputation: 15
The script I wrote is in /etc/profile.d. The name of the file is java.sh. The /etc/profile file is below

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


# 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
unset pathmunge
 
Old 06-10-2005, 10:54 PM   #4
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 52
you just have to follow the paper trail on this one
and ask yourself a few questions and be a script detective

1) what do each of the scripts in /etc/profile.d do ?
2) are there any other scripts that run automatically that are calling all the scripts in /etc/profile.d
or simply rerunning /etc/profile like /etc/bashrc ~/.bash_profile ~/.bashrc
or have you put the code in more than one place
3) i like the function name "pathmunge" are any other of the scripts "munging" with something like
Code:
for directory in $(find /usr/lib/*/bin -type d 2>/dev/null); do
        pathmunge $directory
 
Old 06-11-2005, 05:35 AM   #5
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
and if you post code PLEASE put it between [ code ] and [/ code ] brackets!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NFS: duplicate lisintg issue Fedora007 Linux - Software 3 09-26-2005 08:11 PM
Set the path systemwide/Set the path for a user with Slackware jayhel Slackware 1 06-12-2005 12:24 AM
duplicate gpg key issue Blackrose1 Linux - General 2 03-22-2004 09:33 AM
How to set PATH How do I set PATH environment variable? Tranquil Linux - Newbie 3 11-02-2003 02:52 AM
Duplicate on Laptop Forum SuSE Network Issue Kevin Edmonds Linux - Distributions 0 07-19-2003 10:38 AM


All times are GMT -5. The time now is 04:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration