-   Linux - Newbie (
-   -   $PATH modifications (

ajhunter 10-30-2010 02:08 PM

$PATH modifications
How do I use "push/unshift" to add a directory path to $PATH (this makes a permanent entry, not an entry for the current session). I have used this method before, but I can't remember the correct syntax.

bigrigdriver 10-30-2010 02:29 PM

It might be something like:
export $PATH

udaman 10-30-2010 02:33 PM

You haven't mentioned which distro you're using.

In some distros edit ~/.profile and change this line:


ajhunter 10-30-2010 03:51 PM

re: $PATH Modification
The distro I'm using is FC13. For bigrigdriver, your reply looks familiar but EXPORT was not used. It was just a one-line entry.

bigrigdriver 10-30-2010 05:25 PM

Oops! My bad. I should have also said that the command could be given as:
export $PATH=$PATH:$(push/unshift)

Note that is given in one line.

Dark_Helmet 10-30-2010 07:35 PM

If I may... I don't think we're all on the same page. I say that because the bash shell does not have a command or built-in named push nor unshift. Perl does have both of those commands.

So, I think ajhunter wants a one-liner Perl script--even though it was not specified in the original post. I don't care for Perl. So I can't help beyond giving this link: Perl's env module documentation. Read it and look at the short examples.

Even so, following the examples given on that page will not make the changes permanent. As udaman said, the appropriate entry in ~/.profile (or any other appropriate startup file for your shell) will need to be made/updated.

All times are GMT -5. The time now is 10:54 AM.