Re: safe way to set a path
>>>>> "Hamish" == Hamish Moffatt <hamish@debian.org> writes:
> Somebody recently posted a safe way for a script to append
> to the user's path (only in the current environment). I
> didn't keep it, but now I need it. And the list archive
> search engine is down. Can anyone refresh my memory?
I don't recall the message that you're referring to, but I use
the following functions:
# A function to add to PATH. If it is already there, don't bother...
add_to_path () {
if [ -d $1 ]; then
if [ ! `echo $PATH | grep $1` ]; then
PATH=$1:$PATH
export PATH
fi
fi
}
append_to_path () {
if [ -d $1 ]; then
if [ ! `echo $PATH | grep $1` ]; then
PATH=$PATH:$1
export PATH
fi
fi
}
Mike
Reply to: