From d02188c6edd67cb9a705f9cbfda8db140de99aa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjist=C3=B3f?= Date: Sun, 8 Oct 2017 02:57:44 +0200 Subject: [PATCH] implemented wait --- demo.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/demo.sh b/demo.sh index 1b6a598..841436f 100644 --- a/demo.sh +++ b/demo.sh @@ -1,7 +1,16 @@ #!/usr/bin/env bash TYPE_SPEED="${TYPE_SPEED:-15}" -PROMPT_TIMEOUT="${PROMPT_TIMEOUT:-0}" +PROMPT_TIMEOUT="${PROMPT_TIMEOUT:--1}" function simtyping() { pv -qL $(($TYPE_SPEED+$((-2 + RANDOM%5)))); } + +function wait() +{ + if [ "$PROMPT_TIMEOUT" == "-1" ]; then + read -rs + else + read -rst "$PROMPT_TIMEOUT" + fi +}