ref: https://stackoverflow.com/questions/12524437/output-json-from-bash-script/12524510
Last active
December 16, 2021 05:34
-
-
Save NaClYen/1b74e8bc53aa7351cf01d16bcc3110d1 to your computer and use it in GitHub Desktop.
shell write formatted text file with environment variables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cat <<EOF >/path/to/config.json | |
{ "ip": "$ip"} | |
EOF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
printf '{"ip": "$ip" }' >/path/to/config.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment