Skip to content

Instantly share code, notes, and snippets.

@dewomser
Last active January 28, 2019 10:09
Show Gist options
  • Save dewomser/7e8da29e8e2006757776508fddcbc0cf to your computer and use it in GitHub Desktop.
Save dewomser/7e8da29e8e2006757776508fddcbc0cf to your computer and use it in GitHub Desktop.
parse whole folder for valid YAML
#!/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