[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to add dir to path



Hi Andrew,

On 8/7/07, Andrew Sackville-West <andrew@farwestbilliards.com> wrote:

$PATH is an environment variable like any other and gets assigned a
value in the same way as any other. export is used to make a variable
available to other processes that come after the one spawned by the
assignment process. Thus any process that is a child of the parent of
the export statement gets access to that variable.
so this is just three actions jammed together and its processed in a way
better expressed like this:

<SNIP>

This assignment will only exist in the shell in which it
executed. When you exit that shell, it will disappear along with that
shell.  That's why you put somewhere where it will get started for
every shell...


Thanks for explaining. So I understand that export PATH=~/scripts:$PATH
concatenates "~/scripts" and "$PATH" and sets the result to be the new
$PATH.

This is kinda like on my old Amiga where I have a 'path' command, but
where I must use the ADD option, otherwise the path would be replaced
(like using
export PATH=~/scripts):
path ~/scripts add ==
export PATH=~/scripts:$PATH

If I want an environment variable available all the time, I should place it in
either /etc/profile or ~/.bash_profile, right?

Manon.


Reply to: