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 11-17-2004, 06:34 PM   #1
Coda
LQ Newbie
 
Registered: Feb 2002
Distribution: Fedora Core 3 (sort of)
Posts: 23

Rep: Reputation: 15
$PATH env Problems


Think I was very clever I tried to add the java jdk's bin directory to my path so I could run javac from anywhere. So I ran

PATH=$PATH:usr/java/jre1.5.0/bin

Great... So I added the Java RUN TIME bin to the path. I added the wrong directory. Thinking I was very clever indeed I ran this to get rid of it.

PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin

thinking that it would get rid of everything but the one I just added. Apparently no? Since I did not append to the existing variable I'm missing something important because every time I do

echo $PATH

It thinks that whole long string is one directory and that it doesn't exist. OOOPS.

How do I fix it?
 
Old 11-17-2004, 06:38 PM   #2
secesh
Senior Member
 
Registered: Sep 2004
Location: Savannah, GA
Distribution: Ubuntu, Gentoo, Mythbuntu, ClarkConnect
Posts: 1,154

Rep: Reputation: 47
Quote:
It thinks that whole long string is one directory and that it doesn't exist.
how so -- what's it say?

[edit]
anyways, i don't think i'd worry much -- log out, and back in -- let the system reset it. more: good form to use $HOME/bin over /root/bin, but since you did it from the prompt, not some script, i suppose it doesn't matter...
[/edit]

Last edited by secesh; 11-17-2004 at 06:45 PM.
 
Old 11-17-2004, 06:44 PM   #3
Coda
LQ Newbie
 
Registered: Feb 2002
Distribution: Fedora Core 3 (sort of)
Posts: 23

Original Poster
Rep: Reputation: 15
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin does not exist



Okay... so... I had screwed up the path... in that terminal. I close that terminal emulation and then opened up another and did a

echo $PATH

and it was back to normal. I don't think it's supposed to do that. Let's say it wasn't back to normal. I still have two questions. How would I have fixed the messed up PATH and... How do I make it keep the changes?
 
Old 11-17-2004, 06:47 PM   #4
secesh
Senior Member
 
Registered: Sep 2004
Location: Savannah, GA
Distribution: Ubuntu, Gentoo, Mythbuntu, ClarkConnect
Posts: 1,154

Rep: Reputation: 47
moving on (see my edit above)... keeping the changes -- you use bash?

put your path modifications (after you know they work) into your shell rc script -- ~/.bashrc
 
Old 11-17-2004, 06:51 PM   #5
Coda
LQ Newbie
 
Registered: Feb 2002
Distribution: Fedora Core 3 (sort of)
Posts: 23

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by secesh
moving on (see my edit above)... keeping the changes -- you use bash?

put your path modifications (after you know they work) into your shell rc script -- ~/.bashrc
I assume I use bash. That's the default, no?


Does it matter where I add it in that file? Here's what mine looks like:

Code:
# .bashrc

# User specific aliases and functions

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

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi
 
Old 11-17-2004, 06:53 PM   #6
secesh
Senior Member
 
Registered: Sep 2004
Location: Savannah, GA
Distribution: Ubuntu, Gentoo, Mythbuntu, ClarkConnect
Posts: 1,154

Rep: Reputation: 47
i'd move ALL your custom stuff below that call to /etc/bashrc...
 
Old 11-17-2004, 06:59 PM   #7
Coda
LQ Newbie
 
Registered: Feb 2002
Distribution: Fedora Core 3 (sort of)
Posts: 23

Original Poster
Rep: Reputation: 15
Inside the if statement? Before or after the fi?


What is fi anyway? Just to show that the if statement is over?

Like this?

Code:
# .bashrc

# User specific aliases and functions

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

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
        PATH=/opt/jdk1.5.0/bin:$PATH
fi
 
Old 11-17-2004, 07:00 PM   #8
secesh
Senior Member
 
Registered: Sep 2004
Location: Savannah, GA
Distribution: Ubuntu, Gentoo, Mythbuntu, ClarkConnect
Posts: 1,154

Rep: Reputation: 47
no, below the fi
 
Old 11-17-2004, 07:04 PM   #9
Coda
LQ Newbie
 
Registered: Feb 2002
Distribution: Fedora Core 3 (sort of)
Posts: 23

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by secesh
no, below the fi
BEAUTY. That works. Now I'm cooking with Crisco!

If only ATI had a friggin accelerated driver now for FC3.
 
  


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
C shell and env $PATH vikinnun Programming 1 11-10-2004 10:02 PM
removing one directory in PATH env chunlee Linux - Newbie 4 11-06-2004 08:50 PM
help - what env var for dynamic lib path? emanresu Linux - Newbie 3 05-31-2004 04:32 PM
Changing $PATH env variable alzogbi Linux - Newbie 2 03-26-2004 03:06 AM
RedHat 7.3 PATH env variable problem NewRedHatter Linux - Newbie 4 09-01-2002 06:14 AM


All times are GMT -5. The time now is 05:03 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