Skip to content

Instantly share code, notes, and snippets.

@Narnach
Created January 23, 2009 17:05
Show Gist options
  • Select an option

  • Save Narnach/51081 to your computer and use it in GitHub Desktop.

Select an option

Save Narnach/51081 to your computer and use it in GitHub Desktop.
Remove duplicates from your $PATH environment variable
#!/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