11 declare -l base="${1}"
12 # strip trailing spaces
13 STRIP_TRAILING_WS='s/[[:space:]]\+$//'
14 # line feed at EOF for #include to work properly
16 find "$base" -type f -print0 | sort -z | while read -r -d '' file; do
17 oldHash=$(hash ${file})
18 oldTime=$(stat -c "%Y" ${file})
19 sed -i -e ${STRIP_TRAILING_WS} -e ${ENSURE_EOFLF} ${file}
20 newHash=$(hash ${file})
21 if [[ $newHash == $oldHash ]]; then touch -d @$oldTime ${file}; fi