When I run this function, JAVA_HOME gets set, JUG_BT_ARCH does not get set, and 'gello' gets echoed. I'm sure I'm missing something really obvious.
function j8
set -x JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/
set -x JUG_BT_ARCH amd64-darwin11-xcode4
echo gello
end
Variables by default have function-scope, so when the function ends, they go away. You can make them global via --global
or -g
:
set -gx JUG_BT_ARCH amd64-darwin11-xcode4
Now when you run the function, this variable will stick around.