Bash random sleep timer

Change the 10 to however many seconds you need or want.

echo $(( ( RANDOM % 10 ) +1 ))

Example output

bob@localhost:~$ echo $(( ( RANDOM % 10 ) +1 ))
10
bob@localhost:~$ echo $(( ( RANDOM % 10 ) +1 ))
2
bob@localhost:~$ echo $(( ( RANDOM % 10 ) +1 ))
9
bob@localhost:~$ 

Sleep timer

sleep $(( ( RANDOM % 10 ) +1 ))

Leave a Reply

Your email address will not be published. Required fields are marked *