Created
April 23, 2025 13:03
-
-
Save chmouel/69da429e61aa59a1b25c3a9481d36d4c to your computer and use it in GitHub Desktop.
doloop function again and again
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doloop () { | |
local timeout label | |
label="Press any key to continue" | |
[[ $1 == -t* ]] && { | |
timeout="-t${1#-t}" | |
label="Waiting for ${1} seconds, or press any key to continue" | |
shift | |
} | |
[[ ${1} == "-n" ]] && { | |
shift | |
nowait=true | |
} | |
while true | |
do | |
clear | |
$@ | |
[[ -n ${nowait} ]] && continue | |
echo ${label} | |
read ${timeout} -k1 -s | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment