Skip to content

Instantly share code, notes, and snippets.

@EugenMayer
Created May 1, 2019 15:38
Show Gist options
  • Save EugenMayer/10b79dccf2a48c01c7b0e6cd11e0ce2c to your computer and use it in GitHub Desktop.
Save EugenMayer/10b79dccf2a48c01c7b0e6cd11e0ce2c to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "removing current jenv java's to readd them freshly"
jenv versions --bare | xargs -n1 jenv remove
echo "adding all sdkmans java versions to jenv"
find $HOME/.sdkman/candidates/java -type d -maxdepth 1 -mindepth 1 -exec jenv add '{}' \;
@Victorq10
Copy link

find: warning: you have specified the global option -maxdepth after the argument -type, but global options are not positional, i.e., -maxdepth affects tests specified before it as well as those specified after it. Please specify global options before other arguments.
find: warning: you have specified the global option -mindepth after the argument -type, but global options are not positional, i.e., -mindepth affects tests specified before it as well as those specified after it. Please specify global options before other arguments.

move -type d after -mindepth 1

find $HOME/.sdkman/candidates/java -maxdepth 1 -mindepth 1 -type d -exec jenv add '{}' ;

@tfield
Copy link

tfield commented May 11, 2023

You may want to add in a line to ensure that the jenv config folders exist too:

mkdir -p $HOME/.jenv/versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment