Re: path keeps bloating with repeated entries on invoking subshells



At Wed, 30 Jul 2008 16:18:45 +0000 (UTC) Rahul <nospam@xxxxxxxxxxxxxx> wrote:


In my tcshell I used to follow the construct:

set path=(./ ~/bin/ ~/bin/foocmds [snip]........ $path)

I thought this was the right way to go since I only append to the
systemwide path settings without overwriting anything as a user.

But yesterday I got a "word too long error" and on investigation I find
that each time I invoke a subshell (say, I made a change to the .cshrc or
added a new script to the bin) I find that the path keeps bloating up with
duplicate entries (I guess a side-effect of appending the $path at the
end).

Is there a smart-way around this?

Don't set your path in your .bashrc. Set it in your .bash-login.
Environment variables (like path) are inherieted by sub-shells and every
sub-shell sources .bashrc, so your path is both inherieted AND is being
prepended to.



--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
heller@xxxxxxxxxxxx -- Contract Programming: C/C++, Tcl/Tk

.



Relevant Pages

  • Re: path keeps bloating with repeated entries on invoking subshells
    ... I thought this was the right way to go since I only append to the ... systemwide path settings without overwriting anything as a user. ... duplicate entries (I guess a side-effect of appending the $path at the ...
    (comp.os.linux.misc)
  • path keeps bloating with repeated entries on invoking subshells
    ... In my tcshell I used to follow the construct: ... I thought this was the right way to go since I only append to the ... systemwide path settings without overwriting anything as a user. ... added a new script to the bin) I find that the path keeps bloating up with ...
    (comp.os.linux.misc)