Skip to content

Instantly share code, notes, and snippets.

@NaClYen
Last active December 16, 2021 05:34
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 NaClYen/1b74e8bc53aa7351cf01d16bcc3110d1 to your computer and use it in GitHub Desktop.
Save NaClYen/1b74e8bc53aa7351cf01d16bcc3110d1 to your computer and use it in GitHub Desktop.
shell write formatted text file with environment variables
#!/bin/sh
cat <<EOF >/path/to/config.json
{ "ip": "$ip"}
EOF
#!/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