Created
September 10, 2013 20:08
-
-
Save jaqque/6514866 to your computer and use it in GitHub Desktop.
bash shell function to clean up a PATH, and append . (complete with love note)
Would probably work under zsh, even if $path would be cleaner.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fixpath () { | |
local IFS=: | |
local newpath='' | |
for i in $PATH; do | |
[[ -d "$i" && "$i" != '.' ]] && newpath="$newpath${newpath:+:}$i" | |
done | |
PATH="$newpath:/this_could_be_dangerous/:." | |
} | |
fixpath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment