Simple load testing script in bash
Arithmetics in Bash

You're doing some math in Bash, some in Awk, some in a combination of both. You can do all of that in Bash alone. Most notably, instead of this:


echo $(($(date +%s) - START)) | awk '{print int($1/60)":"int($1%60)}'



This would be equivalent, but all in Bash, without additional processes:

((delta = $(date +%s) - START))
((minutes = delta / 60))
((seconds = delta % 60))
echo $minutes:$seconds


Don't use seq

seq is not portable, I suggest to avoid it. Instead of this:


 for i in `seq 1 $max`; do ...; done



You can write:

for ((i = 1; i &lt; max; i++)); do ...; done


Don't use `...`

This syntax is obsolete today, always use $(...) instead.

Other minor things

This would be clearer as two echo lines, or a here-document with cat &lt;&lt;EOF:


echo "url: $2
rate: $max calls / second"



The trailing semicolon is unnecessary:


START=$(date +%s);



The quoting is unnecessary in date +'%r', but it does no harm.