0

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.

fledgling
  • 991
  • 4
  • 25
  • 48

1 Answers1

3

<(...) 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))
Barmar
  • 741,623
  • 53
  • 500
  • 612
  • Now it tried to do something. I am getting an error `'utf8' codec can't decode byte 0xf8 in position 12: invalid start byte` – fledgling Feb 27 '20 at 01:35
  • 1
    That's a Python error coming from `kms decrypt`, nothing to do with bash. Google it. – Barmar Feb 27 '20 at 01:40