Skip to content

Instantly share code, notes, and snippets.

@adam-stokes
Forked from kdabir/heredoc_json.bash
Created June 14, 2018 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adam-stokes/619872d1b6e29da4f4c930a5ca1f5051 to your computer and use it in GitHub Desktop.
Save adam-stokes/619872d1b6e29da4f4c930a5ca1f5051 to your computer and use it in GitHub Desktop.
json in heredoc in bash script alongwith variable substitution
_BUCKET_NAME="foo.example.com"
_POLICY=$(cat <<EOT
{
"Version":"2012-10-17",
"Statement":[{
"Sid":"PublicReadForGetBucketObjects",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::${_BUCKET_NAME}/*"]
}]
}
EOT
)
echo ${_POLICY}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment