Reputation: 3
In the below code snippet, I keep getting this error message:
#!/bin/sh
java -jar /opt/wiremock/wiremock-standalone-2.7.1.jar -port 9393 --container-threads 200 --verbose >> /opt/wiremock/wiremock.log 2>&1
Error:
bash: /opt/wiremock/script.sh: line 2: 1#015: ambiguous redirect
Feb 8 17:11:27 ssa2 systemd: wiremock.service: main process exited, code=exited, status=1/FAILURE
Feb 8 17:11:27 ssa2 systemd: Unit wiremock.service entered failed state.
Feb 8 17:11:27 ssa2 systemd: wiremock.service failed.**
I have tried commenting out the redirection as in:
java -jar /opt/wiremock/wiremock-standalone-2.7.1.jar -port 9393 --container-threads 200 --verbose #>> /opt/wiremock/wiremock.log 2>&1
and it works properly. However, I would like to make the redirection work so that I have the logs in the specified file.
Upvotes: 0
Views: 813
Reputation: 16752
The first line of your error message is telling you that you have a carriage return at the end of your line.
You have several ways to solve the problem:
Make sure your script has unix-style line endings (eg. dos2unix)
Add a statement terminator to the end of each command, such as: ; #
Upvotes: 1