On Mon, 17 Nov 2003, Jack Coates wrote:

> [EMAIL PROTECTED] jack]$ echo $PATH
> /usr/local/bin/:/home/jack/bin/:/usr/X11R6/lib/xscreensaver/:/sbin/:/usr/sbin/:/usr/local/sbin/:/usr//bin:/bin:/usr/bin::/usr/local/bin:/usr/X11R6/bin:/usr/games:/usr/java/j2re1.4.0_01//bin
> 
> that looks okay... but . is effectively in my path!! I discovered this
> by doing a tab completion line that matched a script in my ~. This is
> with msec level 3

This is because of the "::" that appears about 2/3 of the way into the 
$PATH - this is the functional equivalent of ":.:" ... and that is a Bad 
Thing to have in there, as you know.

I'd suggest hunting through the various places in the scripts where the 
$PATH is amended, and finding where this is being set. There are a number 
of places it could be - /etc/profile, somewhere under /etc/profile.d, 
~/.bashrc, ~/.bash_profile, the rc file for your display manager ...

Or, you might want to just use the checkpath function that was posted in
the alt.os.linux.mandrake newsgroup by Chris F.A. Johnson to clean this
up. You can place a file like the following into your /etc/profile.d dir;
make it executable, and name it "zz_local.sh" (to ensure that it will run
last - they're executed in alphabetical order):

------------

#!/bin/bash

checkpath () 
{ 
    error=0
    newPATH=
    local IFS=":"
    for p in ${PATH//\/\//\/}
    do
        if [ ! -d "$p" ]; then
            echo "checkpath: $p is not a directory; removing it" >&2
        else
            case :$newPATH: in 
                *:$p:*) echo "checkpath: $p already in path" >&2
                ;;
                *)
                    [ -d "$p" ] && newPATH=${newPATH:+$newPATH:}$p
                ;;
            esac
        fi
    done
    PATH=$newPATH
    unset newPATH
}

checkpath
export PATH

------------

This will not only remove the offending "::", it will remove any duplicate
entries it finds (a couple of which you also have in yours), as well as
any entries pointing to dirs which do not exist.

HTH!

-- 
Bill Mullen   [EMAIL PROTECTED]   MA, USA   RLU #270075   MDK 8.1 & 9.0
"An opinion is like a branding iron. It is one thing to hold it, and
another to press it into the skin of a friend." - James Lileks

Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to