LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-05-2004, 02:26 PM   #1
seingoku
Member
 
Registered: Mar 2003
Posts: 34

Rep: Reputation: 15
9.1 set $PATH


Ok I have found this in another thread but I wanna make sure it is right.
I want to set /usr/local/apache2/bin to $PATH.
I don't have a .bashrc but I have a profile file that has PATH. So I could edit the file manually or use
set PATH = $PATH:/usr/local/apache2/bin
I tried that and it does't work.

My other question is why can't I just create a S-link in /usr/local/bin --> /usr/local/apache2/bin/apachectl?

It works but I've never seen this method used. Any cons to doing it this way?

 
Old 02-05-2004, 02:34 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
that will work, however you are not exporting it, so it will only be set WITHIN the profile script itself

export PATH=$PATH:/i/like/pies
 
Old 02-05-2004, 09:11 PM   #3
seingoku
Member
 
Registered: Mar 2003
Posts: 34

Original Poster
Rep: Reputation: 15
THX
How am I able to keep the settings? When I logout the PATH is lost ie not saved. Do I still have to manully edit the profile file? or is there another cmd to do it?

ah ah ah you did't say the magic word ah ah ah
 
Old 02-06-2004, 12:34 AM   #4
snocked
Member
 
Registered: Dec 2002
Location: St. Louis, MO
Distribution: Slackware 9.1
Posts: 482

Rep: Reputation: 30
I've had the same problems. I can't add items to my path. I add them and check the path but still what I added is not in $PATH. I've done it on other distros and unix, but not slack.
 
Old 02-06-2004, 07:08 AM   #5
kiko
Member
 
Registered: Dec 2003
Posts: 47

Rep: Reputation: 15
basically if u used appended :

export PATH=$PATH:/path/to/newPath

into say /etc/profile, then do a

source /etc/profile

The path should bet set ! To test it u can call a program on the new path to test if the path is already set correctly. I had experienced that when I used echo $PATH afterthat it still shows the old value, while the new path actually is already applied .. But when I use:

env | grep PATH

It show the actuals value of the every variable has a sequence of PATH on its name.

Better test whether the new value is already in PATH befor reset/append new value to it, to prevent redudance of value if u source /etc/profile more times.
 
Old 02-06-2004, 02:56 PM   #6
seingoku
Member
 
Registered: Mar 2003
Posts: 34

Original Poster
Rep: Reputation: 15
When I run
export PATH=$PATH:/dvorak/key/board
the PATH is set
when i run
source /etc/profile
PATH is gone to original new PATH is gone
So I am still stuck in the same dilimia.
It is not saving the new PATH when I loout either
8<
 
Old 02-06-2004, 03:12 PM   #7
kiko
Member
 
Registered: Dec 2003
Posts: 47

Rep: Reputation: 15
in /etc/profile there is statement of:

export PATH=...
that is the absolute way to reset a variable (in this case the environment variable PATH)

To make ur definition persistent, append "/dvorak/key/board" on the right side of the last export PATH=... statement on /etc/profile or append the line export "PATH=$PATH:/dv.." above without "" at the end of /etc/profile.

/etc/profile is the system wide profile, so every user login to ur system will source that file first on slackware. To make it guilty only for special user better create an ~/.bash_profile with that line as content.
Code:
cat <<EOF >>  ~/.bash_profile
export PATH=$PATH:/dvorak/key/board

EOF
will do that. Source it whenever u made change to it to make it take effect. Check the content of ur PATH by "env | grep PATH"

Source it several times then check it again. If u don't want to have "/dvorak/key/board" appears redudant in ur $PATH then edit ~/.bash_profile to read like:

Code:
echo $PATH|grep "/dvorak/key/board" 1>dev/null 2>/dev/null
[ $? = 0 ] && export PATH=$PATH:/dvorak/key/board

Last edited by kiko; 02-06-2004 at 03:15 PM.
 
  


Reply

Tags
path, setting



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
how to set my so path? hongxing Linux - Software 1 10-20-2005 02:23 AM
can't set PATH gsrichmo Linux - Software 6 07-16-2005 01:21 PM
Set the path systemwide/Set the path for a user with Slackware jayhel Slackware 1 06-12-2005 12:24 AM
How to set PATH How do I set PATH environment variable? Tranquil Linux - Newbie 3 11-02-2003 02:52 AM
$PATH!? how to set these PATH(s)!? sirpelidor Red Hat 5 10-25-2003 04:00 PM

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

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