Search code examples
bashdockerentry-point

entrypoint.sh - line 9: syntax error: unexpected "("


I am trying to run the following script from docker (based on alpine image)

#!/bin/sh

echo "test"

export USERNAME="AQICAHj456mvH8iSJofL46Xtr7KP6Ng3Vn5k6BpZbkAAAAZTBjBgkqhkiG9w0BBwagVjBUAgEAME8GCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMwCm8C+wSLRm/+sSuAgEQgCJHCFbrIwCQuH0x2iGp13j9SuxMtfrcE6c4SmrHRVkkX24f"
export AWS_REGION="us-east-1"
echo "$AWS_REGION"

decrypt=$(aws kms decrypt --ciphertext-blob fileb://<(echo "$USERNAME" | base64 -d))
export $key="$(echo $decrypt | jq .Plaintext -r | base64 -d)"

exec "$@"

I am getting the below output

test
us-east-1
/bin/entrypoint.sh: line 9: syntax error: unexpected "("

I am not sure how to resolve this syntax error. Any help is appreciated.


Solution

  • <(...) is a bash extension, it's not available in /bin/sh. You don't need it for your script, you should be using $(...) there.

    decrypt=$(aws kms decrypt --ciphertext-blob fileb://$(echo "$USERNAME" | base64 -d))