[ILUG] Editing .bashrc

Kevin O' Riordan kor at compsoc.com
Thu Apr 15 15:12:06 IST 2004


Hi Brian,

> 1) When i try and force the changes to .bashrc by running source
> .bashrc, the new entries are being added to $PATH but older ones, that
> have been removed during last edit, are not.

source'ing a file is the same as entering the contents of that file at
the shell prompt.  So, something similar to this is happening:

    pagh:~ $ export PATH=/usr/bin:/bin
    pagh:~ $ export PATH="/home/me/bin:$PATH"
    pagh:~ $ echo $PATH
    /home/me/bin:/usr/bin:/bin
...
    pagh:~ $ export PATH="/home/me/bin:$PATH"
    pagh:~ $ echo $PATH
    /home/me/bin:/home/me/bin:/usr/bin:/bin

If you want to clear out yr $PATH before adding stuff to it, you'd have
to do so explicitly, with a line like

    pagh:~ $ PATH=

or

    pagh:~ $ unset PATH

Removing specific entries from your $PATH is trickier, involving pattern
matching and replacing.  Less fun than you'd think.


> ... when i log out and back in my original PATH now begins with
>    /usr/local/bin/j2sdkee1.3.1/bin:/usr/local/bin/j2sdkee1.3.1/bin:/usr/local/bin/j2sdkee1.3.1/bin

If '/usr/local/bin/j2sdkee1.3.1/bin:' appears multiple times in your
path, I can only guess that it's added multiple times during login -
check your .bashrc, .bash_profile, .profile, /etc/profile ... it's got
to be in one of those.

hth,
-kev


-- 
bicycle man a woman a fish needs a like needs a



More information about the ILUG mailing list