Last active
January 28, 2019 10:09
-
-
Save dewomser/7e8da29e8e2006757776508fddcbc0cf to your computer and use it in GitHub Desktop.
parse whole folder for valid YAML
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 | |
readarray -t a < <(ls *.yaml) | |
for IND in ${!a[@]}; do | |
lolo="${a[$IND]}" | |
ruby -ryaml -e "Psych.parse(File.open('$lolo'))" | |
if [[ $? -ne 0 ]] | |
then | |
echo "$lolo is not valid YAML" | |
# exit 1 | |
else | |
echo "$lolo is a valid YAML" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment