Jesús Guerrero writes:

> "Boris Fersing" <[EMAIL PROTECTED]> escribió:
> > You don't need to export the variable...
>
> You do, unless you plan to use that variable only instead of the
> script, in this case, ~/.bashrc

But PATH is exported already, so there is no need to do this again I think.

> And one thing you should consider is to use something to check if the
> path has been already added. Otherwise you will end having a lot of
> times that same path in your ${PATH} variable.
>
> For example:
>
> if [[ -n `echo $PATH | grep "/insert/your/path/here"` ]]
>   then
>
>     : # Fallback
>
>   else
>     PATH=/usr/local/bin:$PATH
>     export PATH
> fi

Or a little shorter:

path=/insert/your/path/here
[[ $PATH = *$path* ]] || PATH=$path:$PATH

        Alex

-- 
[email protected] mailing list

Reply via email to