#!/bin/sh

for i in ./study/0/*.json; do
    echo "Validating $i"
    python -mjson.tool $i /dev/null || exit $?
done

#!/bin/sh

for i in ./study/0/*.json; do
    echo "Validating ./study/0/$i"
    cat $i | python -mjson.tool > /dev/null
    if [ $? -ne 0 ]; then
        exit $?
    fi
done

--- 
+++ 
@@ -1,9 +1,6 @@
 #!/bin/sh
 
 for i in ./study/0/*.json; do
-    echo "Validating ./study/0/$i"
-    cat $i | python -mjson.tool > /dev/null
-    if [ $? -ne 0 ]; then
-        exit $?
-    fi
+    echo "Validating $i"
+    python -mjson.tool $i /dev/null || exit $?
 done
Exit with the proper error code when a JSON file is invalid
