bmwcarit / barefoot

Java map matching library for integrating the map into software and services with state-of-the-art online and offline map matching that can be used stand-alone and in the cloud.
Apache License 2.0
665 stars 186 forks source link

Simplify appending to env var JAVACMD_OPTIONS #96

Open aureliojargas opened 6 years ago

aureliojargas commented 6 years ago

In default Bash, it is not an error to refer to an undeclared (or empty) variable. In that case, it will just expand to an empty string.

So there's no need to do the prior check, you can just append the new value right away.

Also, in Bash you can safely set and export on the same command.

jongiddy commented 6 years ago

Thanks. I love the conciseness of this! PR #90 adds -o nounset to this file, so when that is merged, this won't work as is. But it could still be a one-liner.

aureliojargas commented 6 years ago

@jongiddy thanks for the heads-up!

In that case, the ${foo:-} parameter expansion should do the trick to avoid raising error when unset.

Since it will also work even when -o nounset is not active, I'll update this PR with the fix.