Skip to content

Instantly share code, notes, and snippets.

@magickatt
Created November 23, 2020 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magickatt/b45a29765d0682ec6faa8e7279994d38 to your computer and use it in GitHub Desktop.
Save magickatt/b45a29765d0682ec6faa8e7279994d38 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Random number between 1 and 10
WAIT=`shuf -i 1-10 -n 1`
# Subtract 1 from the random number, check if it is now 0
is_random_number_zero () {
let WAIT=WAIT-1
return $([[ "$WAIT" -eq "0" ]])
}
# Check if random number is 0 then sleep for 1 second, loop
until is_random_number_zero; do
sleep 1s;
echo $WAIT
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment