Skip to content

Instantly share code, notes, and snippets.

@loverdos
Created July 17, 2009 13:13
Show Gist options
  • Save loverdos/149043 to your computer and use it in GitHub Desktop.
Save loverdos/149043 to your computer and use it in GitHub Desktop.
if(2 != args.length) {
System.err.println("Usage: change-path-element in-elem out-elem")
System.exit(1)
}
val In = args(0)
val Out = args(1)
//println("In = " + In)
//println("Out = " + Out)
val Path = System.getenv("PATH")
val PathSep = System.getProperty("path.separator")
//println()
//println("PATH = " + Path)
val NewPath = Path.split(PathSep) map { elem =>
if(elem == In) Out else elem
} mkString PathSep
//println()
print(NewPath)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment