File: check_json_format.sh

package info (click to toggle)
cloud-init 22.4.2-1%2Bdeb12u3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,088 kB
  • sloc: python: 108,898; sh: 4,091; makefile: 147; xml: 22
file content (11 lines) | stat: -rwxr-xr-x 235 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
#!/bin/sh
#
# Run python's json.tool and check for changes
#
# requires python 3.9 for --indent
#
file=$1
before=$(cat "$file") &&
	python3 -m json.tool --indent 2 "$file" "$file" &&
	after=$(cat "$file") &&
	test "$before" = "$after"