Created
May 8, 2020 12:59
-
-
Save eduo/6d8b9da717574d1b56f39c0043d81185 to your computer and use it in GitHub Desktop.
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 | |
# | |
ls -1 *xml | while read FILE | |
do | |
FILENAME=${FILE##*/};FILEPATH=${FILE%/*};NOEXT=${FILENAME%\.*};EXT=${FILE##*.} | |
#echo "Testing for ${FILE} as ${NOEXT}" | |
xmllint --noout --schema ~/main.xsd ${NOEXT}.xml 2> ${NOEXT}.errors.txt | |
if grep --quiet validates ${NOEXT}.errors.txt ; then | |
# echo "${FILE} validates..." | |
rm ${NOEXT}.errors.txt | |
else | |
echo "Errors found in ${FILE}" | |
echo "Found $(cat ${NOEXT}.errors.txt|wc -l |bc) errors in ${NOEXT}.xml" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment