Build a JSON string with Bash variables

后端 未结 12 1431
感情败类
感情败类 2020-11-29 01:57

I need to read these bash variables into my JSON string and I am not familiar with bash. any help is appreciated.

#!/bin/sh

BUCKET_NAME=testbucket
OBJECT_N         


        
12条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-29 02:45

    can be done following way:

    JSON_STRING='{"bucketname":"'$BUCKET_NAME'","objectname":"'$OBJECT_NAME'","targetlocation":"'$TARGET_LOCATION'"}'
    

提交回复
热议问题