workplace/lib/snore
2024-05-11 23:44:11 +02:00

11 lines
186 B
Bash

#!/bin/bash
#
# Efficient sleep (does not create a new process).
#
snore(){
local IFS
[[ -n "${_snore_fd:-}" ]] || exec {_snore_fd}<> <(:)
read ${1:+-t "$1"} -u $_snore_fd || true
}