Forked from fduran/Linux Bash generate a number of files of random sizes in a range
Created
July 21, 2022 00:24
-
-
Save MiSERYYYYY/87b8adbb93d3215fbd83bd05e5d3ea1c to your computer and use it in GitHub Desktop.
Linux Bash generate a number of files of random sizes in a range
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # generate a number of files with random sizes in a range | |
| min=1 # min size (MB) | |
| max=10 # max size (MB) | |
| nofiles=20 # number of files | |
| for i in `eval echo {1..$nofiles}` | |
| do | |
| dd bs=1M count=$(($RANDOM%max + $min)) if=/dev/urandom of=./files/file$i | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment