In this question
@SiegeX gives a nice way of cleaning the bash PATH variable from
duplicate entries:
PATH=$(awk 'BEGIN{ORS=":";RS="[:\n]"}!a[$0]++' <<<"${PATH%:}")
this works well when I type it in the command line.
I tried using this in a bash function to be able to apply it to other variables:
function dupremove()
{
${1}=$(awk 'BEGIN{ORS=":";RS="[:\n]"}!a[$0]++' <<<"${1%:}")
}
but when I execute it it gives the error:
> dupremove PATH
bash: PATH=PATH:: command not found
Any idea on I can write the function?
This works for me (TM)