Articles with the tag « script » :

bash - remove duplicates from PATH w/o changing the declared order

in «tip» by Michael Beard
Tags: , , , , ,

Useful to put in your .bash_profile file to remove all of the churn that gets added to your PATH environment variable.

#### -------------------
#### remove any duplicates in PATH - w/o changing order
#### -- https://stackoverflow.com/questions/11650840/remove-redundant-paths-from-path-variable
#### -------------------
export PATH="$(echo "$PATH" | awk 'BEGIN{RS=":";}
{sub(sprintf("%c$",10),"");if(A[$0 …