Reputation: 4123
I want to run this shell script:
#!/usr/bin/env sh
set -e
sbt <<_EOF_
set name := "foo"
set organization := "bar"
publish
_EOF_
I don't want interactive mode, when i run this script sbt doesn't stop working after last line. How to pass multiple set expressions in way like that and leave interactive mode? I need to pass many set parameters in this script, i don't know the best way
UPDATE: publish command may fail. I want this scenario: if it fails then sh script would have non zero exit, otherwise exit 0 (no errors)
Upvotes: 1
Views: 112
Reputation: 48420
Use SBT batch mode specifying a space-separated list of sbt commands as arguments:
#!/usr/bin/env sh
set -e
sbt 'set name := "foo"' 'set organization := "bar"' publish
If publish
throws, say, java.lang.RuntimeException: Repository for publishing is not specified
, then echo $?
should return non-zero exit code.
Upvotes: 1