Bash Timeout Loops
Jump to navigation
Jump to search
Internal
Overview
...
local timeout_sec=...
local t0=$(date '+%s')
local remaining=$(expr ${timeout_sec} + ${t0} - $(date '+%s'))
while [[ ${remaining} -gt 0 ]]; do
debug "remaining ${remaining} secs ..."
sleep 1
remaining=$(expr ${timeout_sec} + ${t0} - $(date '+%s'))
done