I am trying to repeatedly run a python script a random number of times using bash. However, to avoid running the script a massive amount of times I want to place an upper limit on the amount of times it can run. Currently I am using the 'modulo' operator to return a remainder and then using that as a string when performing a loop:
#!/bin/bash
RANGE=1000
number=$RANDOM
let "number %= $RANGE"
for run in {1..$number}
do
python script.py
done
The random number works (i.e. $number is a random number between 1-1000), but the problem is that this only seems to be running the script once, no matter what the random number is.
What might the problem be?
Aucun commentaire:
Enregistrer un commentaire