Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple YAML fine validation for syntax
#! /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
You can’t perform that action at this time.