0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

シェルスクリプト内で読み込まれるJSONに環境変数を渡す方法

Posted at

やり方

  • ''で囲う
  • 次のシェルでは、JSONデータが次の3つのブロックに別れることになり、環境変数を読み込ませている箇所"'${1}'"のみ展開されるようになる
  • たぶんメンテナンスするのは大変

code-build.sh
#!/bin/bash

aws codebuild start-build \
  --project-name test \
  --environment-variables-override '[
    {
      "name": "API_HOST",
      "value": "'${1}'",
      "type": "PLAINTEXT"
    },
    {
      "name": "IMAGE_TAG",
      "value": "0.9.1",
      "type": "PLAINTEXT"
    }
  ]'    
sh code-build.sh vamdemic
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?