LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   manipulating $PATH variable (https://www.linuxquestions.org/questions/linux-newbie-8/manipulating-%24path-variable-207006/)

mfazi1612 07-19-2004 12:59 PM

manipulating $PATH variable
 
Hi all,

I set the $PATH variable using

set PATH = ..........

My question is how do i remove items from the $PATH variable and say, change their order?

Thanks

osvaldomarques 07-20-2004 12:18 AM

Man,
Your question has too many answers. Each one who posts here will give you one solution. If you want to change the order of the path for a specific script, may be the best is to put the preferred paths in front of the path list which you have. By the command you used as example, I suppose you are using C shell. I don't know its syntax to give you an example. But in bourne shell, from which bash is descendant, suppose I have this path:
PATH=/usr/bin:/bin:/usr/sbin:/sbin:.... and we want some script to look first in /sbin, but maintain all the search path, we would do:
PATH=/sbin:$PATH
We could compose an editor for the path, but we would spend too much effort before the task to be done.

mfazi1612 07-20-2004 07:37 AM

Thanks for your reply.

320mb 07-20-2004 08:06 AM

Bash has certain words that are "built in" to it.........."set" and "unset" are just two of them............."export" is another built in word.

IF your doing something specific like building an LFS system......you'll need to set a $PATH variable to use on a temporary basis.......example

Code:

export $LFS=/LFS
as osvaldomarques said, there are many answers to your question...........

osvaldomarques 07-20-2004 11:22 PM

Hi 320mb,
I would want alert you your command has an extra dollar; you have to enter
Code:

export LFS=/LFS
The references to this variable will be obtained with this symbol
Code:

cd $LFS


All times are GMT -5. The time now is 09:34 AM.