Skip to content

Instantly share code, notes, and snippets.

@tobias
Created December 9, 2016 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobias/71be640975b19a5d92f8b1b01be7f2e0 to your computer and use it in GitHub Desktop.
Save tobias/71be640975b19a5d92f8b1b01be7f2e0 to your computer and use it in GitHub Desktop.
function setjdk
if test -n "$JAVA_HOME"
removeFromPath "$JAVA_HOME/bin"
end
set -gx JAVA_HOME (/usr/libexec/java_home -v $argv[1])
set -gx PATH $JAVA_HOME/bin $PATH
end
function removeFromPath
set -l idx 0
for x in (seq (count $PATH))
if test "$argv[1]" = "$PATH[$x]"
set idx $x
end
end
if test $idx -gt 0
set -e PATH[$idx]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment