#!/bin/bash GITROOT="$(git rev-parse --show-toplevel)"||exit 1 SUDOERSDINV=( $(find "$GITROOT" -name sudoers.d -type d) ) SUDOERSD=1 [ "${#SUDOERSDINV[@]}" -eq 0 ]&&echo "No directory called sudoers.d found."&&SUDOERSD=0 [ "$SUDOERSD" -eq 1 ]&&for i in "${SUDOERSDINV[@]}"/*;do /usr/sbin/visudo -cf "$i";done find "$GITROOT" -name sudoers -type f -exec /usr/sbin/visudo -cf '{}' \;