Files
kubernetes/hooks/boilerplate.sh

14 lines
308 B
Bash
Executable File

#!/bin/bash
# Print 1 if the file in $1 has the correct boilerplate header, 0 otherwise.
FILE=$1
LINES=$(cat "$(dirname $0)/boilerplate.txt" | wc -l | tr -d ' ')
DIFFER=$(head "-${LINES}" "${FILE}" | diff -q - "$(dirname $0)/boilerplate.txt")
if [[ -z "${DIFFER}" ]]; then
echo "1"
exit 0
fi
echo "0"