LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Pathbeing set from unknown location (https://www.linuxquestions.org/questions/linux-general-1/pathbeing-set-from-unknown-location-236746/)

camroe 09-29-2004 01:39 PM

Pathbeing set from unknown location
 
So - this is not a show stopper but it is really bugging me. :(

My (non-root user) path is currently set to

/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/ant/bin:/usr/local/mysql/bin:/usr/local/bin:/usr/local/JMatos1.1:/home/camroe/bin

There are 2 things wrong with this PATH.

1. /usr/local/bin appears twice
2. I can't figure out where /usr/local/JMatos1.1 is being set from!

I have carefully followed the places where I think that PATH is being set. Here is what I understand to be the case.

0. For a non-root user the PATH defaults to be /usr/local/bin:/usr/bin:/bin
1. /etc/profile
1a. /etc/profile executes all the '.sh' files in /etc/profile.d
1b. /etc/profile executes inputrc
2. /$HOME/.bash_profile
2a. .bash_profile executes .bashrc
2aa. .bashrc executes /etc/bashrc

In following this path I can see nowhere where /usr/local/bin or /usr/local/JMatos1.1 is being set. I assume that the initial /usr/local/bin:/usr/bin:/bin settings in the PATH are there by default. (where would this be set ?)

I have grep'ed /etc/profile.d/*.sh for /usr/local/bin and 'JM' and found nothing. I have checked every file in the above list for the setting of /usr/local/bin or JMatos and can't find them.

Is there anywhere else I can look? Again this is not a show stopper but it's bothering me that things are being set and I can't find out where. I've included below

1. /etc/profile
2. .bash_profile
3. .bashrc

If someone could point me in the right direction it would be great!

Thanks

Cam

-------------------------------------------------------
# /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 for root or u=0
if [ `id -u` = 0 ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
#Move the setting of the Java path to each individual
# pathmunge /usr/java/jdk1.3.1_03/bin/
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
CATALINA_HOME=/usr/local/tomcat
MYSQL_HOME=/usr/local/mysql
#JAVA_HOME=/usr/java/jdk1.3.1_03
JAVA_HOME=/usr/java/j2sdk1.4.2_05
ANT_HOME=/usr/local/ant
pathmunge ${ANT_HOME}/bin
pathmunge ${MYSQL_HOME}/bin
#export PATH=${PATH}:/usr/local/bin
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC ANT_HOME JAVA_HOME CATALINA_HOME MYSQL_HOME
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
unset i
unset pathmunge
-----------------------------------------------------------
# .bash_profile

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

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME

--------------------------------------------------

# .bashrc

# User specific aliases and functions
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

Tinkster 09-29-2004 03:39 PM

Have a look at the scripts in the /etc/profile.d
directory too ...


Cheers,
Tink


All times are GMT -5. The time now is 07:33 AM.