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

Re: 2 questions



On Mon, Sep 02, 2002 at 05:52:02PM -0500, Jamin W. Collins wrote:
> On Mon, 2 Sep 2002 18:39:11 -0400
> Edward Guldemond <thedebategod@yifan.net> wrote:
> > Put 'export' before the $PATH part.  For example:
> > export $PATH="$PATH:/new_dir"
> 
> The above won't work.  You don't want the $ on the name of the variable
> you are exporting.  So, the line would look more like this:
> 
>   export PATH="$PATH:/new_dir"
> 
> However, /etc/profile already does the PATH exporting.  When you added the
> entry, did you ensure that the addition was before the line reading:
> 
>   export PATH

That doesn't matter, though. 'export' just marks a variable to be
exported - it doesn't save its current value and export that. Watch:

  $ foo=hello
  $ export foo
  $ echo $foo
  hello
  $ foo=world
  $ echo $foo
  world
  $ bash
  $ echo $foo
  world

More likely, /etc/profile simply isn't being read in the context in
which the original poster is expecting it to work, probably because it's
only read for login shells and xterms you launch aren't login shells by
default. See the INVOCATION section of the bash(1) man page, and
consider using ~/.bash_profile and ~/.bashrc instead.

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: