Created
October 28, 2020 11:21
-
-
Save packmad/1596cfaf9828bd90506dbcefbf200e09 to your computer and use it in GitHub Desktop.
Bash function that finds if a directory contains invalid JSON files
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
function check_valid_jsons_folder() { | |
if [ -d "$1" ]; then | |
find $1 -type f -iname "*json" | while read p; do if ! jq empty < $p > /dev/null 2>&1; then echo '> Invalid JSON: '$p; fi; done | |
else | |
echo "'$1' is not a directory!" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment