LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions
User Name
Password
Linux - Distributions This forum is for Distribution specific questions.
Red Hat, Slackware, Debian, Novell, LFS, Mandriva, Ubuntu, Fedora - the list goes on and on... Note: An (*) indicates there is no official participation from that distribution here at LQ.

Notices


Reply
  Search this Thread
Old 12-24-2003, 02:52 PM   #1
JoeDuncan
Member
 
Registered: Aug 2003
Location: Ottawa
Distribution: Redhat 5.2, 6.0, 6.1, Mandrake 7.2, 8.0, 9.1, 9.2, 10.0, Gentoo, Debian 3.1r0
Posts: 224

Rep: Reputation: 30
PATH Variable in Mandrake


Ok, this is is really bugging me. I am trying to set the PATH variable on my Mandrake 9.1 system, and I have looked in all the standard places to do this:

/etc/profile
/home/<me>/.bash_profile

But neither seems to be the "master" setting of the PATH variable...

My PATH is:

$ echo $PATH
/usr//bin:/bin:/usr/bin::/usr/local/bin:/usr/X11R6/bin:/usr/games:/home/joe/bin:/usr/java/j2sdk1.4.1_05/bin

I would like to get rid of the double "//" and the double "::" in the path because it annoys me, and I also want better control over the PATH for adding directories etc...

Now in my /etc/profile I have:

# Users generally won't see annoying 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

Which accounts for the ":/usr/X11R6/bin:/usr/games" portion of the path and in my /home/<me>/.bash_profile, I have:

PATH=$PATH:$HOME/bin
PATH=$PATH:/usr/java/j2sdk1.4.1_05/bin

Which accounts for the ":/home/joe/bin:/usr/java/j2sdk1.4.1_05/bin" portion of the PATH, but that still leaves the "/usr//bin:/bin:/usr/bin::/usr/local/bin" portion unaccounted for.

I have found on Google groups discussions of this where they say to check in /etc/rc.sysinit, so I did, ini there I have:

# Set the path
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH

Which doesn't seem to match at all what is actually in the PATH, it looks like this is the first place where the PATH is being set (i.e. there's no "$PATH" reference in the assignment), but if that were true, how come, some of it is then later deleted??? Also stuff seems to be being added in front of the PATH, which while possible, seems to go against most good coding practices...

Also, some other postings suggest running the following command:

find /etc -type f -exec grep -H 'PATH' {} \;

Which returns a whole lot of files, but the following looked promising:

/etc/profile.d/msec.sh
/etc/profile.d/msec.csh
/etc/csh.login

However, /etc/profile.d/msec.csh and /etc/csh.login seem to be C Shell srcipts and I am using Bash... /etc/profile.d/msec.sh only contains the following:

if [ -n "$SECURE_LEVEL" ]; then
if [ "$SECURE_LEVEL" -le 1 ] && ! echo ${PATH} | fgrep -q :.; then
export PATH=$PATH:.
fi
fi

Which doesn't seem very helpful...

Does anyone know where the original PATH variable is set in Mandrake Linux???

Thanks!
 
Old 12-24-2003, 03:11 PM   #2
Nu-Bee
Member
 
Registered: Dec 2002
Location: USA
Distribution: Mandrake 9.2
Posts: 269

Rep: Reputation: 30
You do not want to remove the // and :: from that list...they have a purpose for being there.
 
Old 12-24-2003, 10:01 PM   #3
JoeDuncan
Member
 
Registered: Aug 2003
Location: Ottawa
Distribution: Redhat 5.2, 6.0, 6.1, Mandrake 7.2, 8.0, 9.1, 9.2, 10.0, Gentoo, Debian 3.1r0
Posts: 224

Original Poster
Rep: Reputation: 30
Ok, so what is their purpose and where are they being set? I at least want to know what they do and where they are configured...

Thanks!
 
Old 12-27-2003, 11:38 AM   #4
Skyline
Senior Member
 
Registered: Jun 2003
Distribution: Debian/other
Posts: 2,104

Rep: Reputation: 45
Quote:
I am trying to set the PATH variable on my Mandrake 9.1 system, and I have looked in all the standard places to do this:
For example - adding a new directory to your PATH: /home/joe/programs

in an xterm

PATH=$PATH:/home/joe/programs

export PATH

then

echo $PATH

and you'll see your new directory appended to the end of the list.....
 
Old 12-27-2003, 01:05 PM   #5
colnago
Member
 
Registered: Nov 2003
Location: Canada
Distribution: ArchLinux
Posts: 324

Rep: Reputation: 30
Try looking in /etc/rc.sysinit

I am not 100% sure for your system, as I use tcsh on a r10 beta.

Sometimes there is a /home/<you>/.bashrc file as well, but it is unlikely the place for this.
 
  


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
enviroment variable PATH Moataz Linux - Newbie 2 04-25-2005 08:25 PM
PATH variable jk21 Linux - Newbie 1 09-28-2004 02:48 PM
$path variable ? moby Linux - Newbie 3 06-01-2004 03:18 PM
the path variable mjkramer Linux - Newbie 4 10-18-2003 07:18 AM
setting path variable shahrahulb Linux - General 2 07-30-2003 08:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions

All times are GMT -5. The time now is 06:07 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
Open Source Consulting | Domain Registration