Here is script i am planning to use to generate 500 test files populated with random data.
for((counter=1;counter<=500;counter++));
do
echo Creating file$counter;
dd bs=1M count=10 if=/dev/urandom of=file$counter;
done
But what i need the script to do is make those 500 files to be of variable size as in let say between 1M and 10M; ie, file1=1M, file2=10M, file3=9M etc …
any help?
This will generate 500 files each containing between 1 and 10 megabytes of random bytes.
#!/bin/bash
max=10 # number of megabytes
for ((counter=1; counter<=500; counter++))
do
echo Creating file$counter
dd bs=1M count=$(($RANDOM%max + 1)) if=/dev/urandom of=file$counter
done
The second line could instead be:
for counter in {1..500}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With