Skip to content

Instantly share code, notes, and snippets.

@foragerr
Created October 3, 2016 17:22
Show Gist options
  • Save foragerr/4167b553d5bb165be52528561d0c1c39 to your computer and use it in GitHub Desktop.
Save foragerr/4167b553d5bb165be52528561d0c1c39 to your computer and use it in GitHub Desktop.
Check if env variable is set
task sysPropCheck << {
if (System.getenv('sysproptest'))
println 'sysproptest is set to ' + System.getenv('sysproptest')
else
println 'set sysproptest first!'
}
//Output:
// $ gradle -q sysPropCheck
// set sysproptest first!
// $ export sysproptest=FOO
// $ gradle -q sysPropCheck
// sysproptest is set to FOO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment