Remove duplicate paths in your PATH environment variable
This is a handy bash script to remove duplicate PATH directories but doesn't modify the order of the path already listed. Pretty cool idea.
Here is the url: remove duplicate dirs from PATH
Here is the code:
export PATH="$(echo "$PATH" | awk 'BEGIN{RS=":";}
{sub(sprintf("%c$",10),"");if(A[$0]){}else{A[$0]=1;
printf(((NR==1)?"":":")$0)}}')";
I try to put this towards the bottom of the .bash_profile file so that it is after any changes to the PATH environment variable.