#!/bin/bash function clang_format() { echo "verifying 'clang-format --output-replacements-xml --style=Google $@'" if clang-format --output-replacements-xml --style=Google "$@" | grep -q ' "$tmpfile" ec=0 while read -r file; do if ! clang_format "$file"; then ec=255 fi done < "$tmpfile" rm -f "$tmpfile" exit "$ec"