Search code examples
bashunixapachebench

apache ab in for loop


I'd like to run apache ab test more times with different parameters that will be stored in an array. eg.:

$array {10,50,100,500,1000}
for $i in $array
ab -A name:pass -n $i -c $i http://www.google.com/.... > file_$i.txt

While it's important that, to begin the i-th test, the previous test has to be finished.


Solution

  • off the top of my head (untested)

    array=(10 50 100 500 1000)
    for i in ${array[@]}; do
      ab -A name:pass -n $i -c $i http://www.google.com/.... > file_$i.txt
    done