bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: remove paths


From: MrEye
Subject: Re: remove paths
Date: Fri, 20 Jul 2001 08:41:24 -0400

Thank you.

"Paul Jarc" <address@hidden> wrote in message
news:address@hidden
> "MrEye" <address@hidden> writes:
> > How do you remove a directory path from the $PATH variable?
>
> With effort.  I use this function to remove duplicate entries from
> PATH and similar variables; season to taste.
>
> function cleanpath {
>   local var="${1:-PATH}" oldpath newpath=: entry
>   oldpath="${!var}:"
>   while [ -n "$oldpath" ]; do
>     entry="${oldpath%%:*}"
>     oldpath="${oldpath#*:}"
>     [ "${entry:0:1}" = / ] && [ -n "${newpath##*:$entry:*}" ] &&
>       [ -d "$entry" ] && newpath="$newpath$entry:"
>   done
>   newpath="${newpath#:}"
>   eval "$var"'="${newpath%:}"'
> }
>
>
> paul





reply via email to

[Prev in Thread] Current Thread [Next in Thread]