Created
May 28, 2013 07:26
-
-
Save toddlers/5661057 to your computer and use it in GitHub Desktop.
Simple YAML fine validation for syntax
This file contains hidden or 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 | |
file=$1 | |
set -a | |
if [ -z "$file" ]; then | |
echo "need YAML file as first arg" | |
exit 2 | |
fi | |
if [ -f $file ]; then | |
YAML_FILE=$file | |
perl -MData::Dumper -MYAML -e '$h = YAML::LoadFile($ENV{YAML_FILE}); print Dumper $h' && echo OK || echo Failed | |
else | |
echo $file: no such file or directory | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment