I am using SDKMAN! and I am trying to write sdkinit.sh
script for my project to initialize current shell with specific tools versions.
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk use groovy 2.4.16
sdk use java 8.0.212-zulu
Even though I call the script, the changes are not applied to shell according to the following output
➜ dir git: ✗ ./sdkinit.sh
-e Using groovy version 2.4.16 in this shell.
-e Using java version 8.0.212-zulu in this shell.
➜ dir ✗ java -version
openjdk version "12.0.1" 2019-04-16
OpenJDK Runtime Environment Zulu12.2+3-CA (build 12.0.1+12)
OpenJDK 64-Bit Server VM Zulu12.2+3-CA (build 12.0.1+12, mixed mode, sharing)
I use zsh on macOS.
Is there a way to make it working?
I see there's issue for it in the project, but it's not started yet, so I am looking for writing my own script.
Script is running in separate bash. You can try executing script like that.
. ./sdkinit.sh
For more information look here: How to execute bash script in same shell