On Sun, 7 May 2000, Bruce A. Mallett wrote:

> While on the PATH manipulation subject, I find the following function
> handy when using ksh.  It eliminates duplicates in a PATH style string.
> This is useful when one has a lot of things like:
> 
>    export PATH="$PATH;/some/new/stuff"
> 
> These tend to accumulate a lot of duplicate entries which can be eliminated
> using this function by:
> 
>    RemoveDups "$PATH"
>    export PATH="$_RemoveDups"

i'm nervous about the technique of returning arbitrary values from
functions by assigning those values to a global variable.  an
alternative technique is to have the function return the value
by printing it, and getting that value using command substitution:

PATH=$(RemoveDups $PATH)

  the RemoveDups function itself would then, as the last statement,
simply

print <new path>

  comments?

rday


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to