Skip to content

Instantly share code, notes, and snippets.

@jaqque
Created September 10, 2013 20:08
Show Gist options
  • Save jaqque/6514866 to your computer and use it in GitHub Desktop.
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.
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