#!/usr/bin/env sh IFS=$'\n' TOTAL=0 for I in $(ls -1 playtime 2>/dev/null); do TOTAL=$(echo $(cat "playtime/${I}") + "${TOTAL}" | nickle) done echo Total seconds: ${TOTAL} echo Total minutes: $(echo ${TOTAL} / 60 | nickle) echo Total hours: $(echo ${TOTAL} / 60 / 60 | nickle) echo Total days: $(echo ${TOTAL} / 60 / 60 / 24 | nickle) echo Total years: $(echo ${TOTAL} / 60 / 60 / 24 / 365.25 | nickle)