Created
January 23, 2009 17:05
-
-
Save Narnach/51081 to your computer and use it in GitHub Desktop.
Remove duplicates from your $PATH environment variable
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
| #!/usr/bin/env ruby | |
| # cleanpath - Cleanup your $PATH! | |
| # | |
| # Reads the current $PATH and outputs a version without duplicate entries. | |
| # It is useful as a last line in ~/.profile: | |
| # export PATH=`/path/to/cleanpath` | |
| path = ENV['PATH'] | |
| clean_path = path.split(":").uniq.join(":") | |
| puts clean_path | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment