#!/bin/sh set -e for FILE in $(find . -maxdepth 1 -mindepth 1 -type f -and -not -name "*.sha512" -and -not -name "*.sig") do if [ -e "${FILE}" ] && [ ! -e "${FILE}.sha512" ] then echo "${FILE}" sha512sum "${FILE}" > "${FILE}.sha512" touch -r "${FILE}" "${FILE}.sha512" fi done