From 604eff546f4296ff96327ee989c698e24a4c2534 Mon Sep 17 00:00:00 2001 From: DevGnome Date: Thu, 7 Nov 2024 09:45:31 -0500 Subject: [PATCH] new delay script, very simple, but handy. --- delay.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 delay.sh diff --git a/delay.sh b/delay.sh new file mode 100755 index 0000000..0a94963 --- /dev/null +++ b/delay.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# optionally takes a single argument of how long of a delay to take. defaults to 5 seconds. +seconds=$1 + +# seconds +if [[ "$seconds" -lt "1" ]] || [[ "$seconds" -gt "60" ]]; then + seconds=5 +fi + +# convert delay in seconds to 1/50 slice of time +slice=$(echo "scale=3; $seconds/50" | bc -l) + +echo '' +for i in $(seq 1 50); do + sleep "$slice" + echo -n '.' +done +echo '' +