Shell: Dedup PATH variable
How to handle duplicates in your PATH variable? Use the following one liner:
PATH="$(perl -e 'print join(":", grep { not $seen{$_}++ } split(/:/, $ENV{PATH}))')"
Via SO.
How to handle duplicates in your PATH variable? Use the following one liner:
PATH="$(perl -e 'print join(":", grep { not $seen{$_}++ } split(/:/, $ENV{PATH}))')"
Via SO.
Leave a comment