Browse - Programming Tips - How can I have a random delay in a bash script?
Date: 2016jun15 Language: bash Q. How can I have a random delay in a bash script? A. Use $RANDOM and sleep like this:#!/bin/sh # Make a random number less than 10 delay=$((RANDOM % 10)) # Display it echo "delay=$delay" # Sleep for it sleep $delayOr simply:sleep $((RANDOM % 10))Note that case matters, $random doesn't work.