2

Shell: Dedup PATH variable

 1 year ago
source link: https://proinsias.github.io/til/shell-dedup-path-variable/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Francis T. O'Donovan

Senior Data Science Manager at Hospital IQ – Planet discoverer, researcher, developer, geek.

Shell: Dedup PATH variable

less than 1 minute read

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.

Tags: bash path shell til

Categories: til

Updated: June 25, 2022

Previous Next

You May Also Enjoy


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK