Created
July 9, 2019 07:03
-
-
Save hanbei/acc07306dddfc05e98599a6cf21b5f1b to your computer and use it in GitHub Desktop.
Format a json file with jq in place
This file contains 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/bash | |
tmpf=$(mktemp --tmpdir=$(dirname $1) -t) | |
jq . "$1" > "$tmpf" | |
mv -f "$tmpf" "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment