Last active
August 29, 2015 13:56
-
-
Save akoenig/9324521 to your computer and use it in GitHub Desktop.
Little bash script which generates some random files (max file size ~3 MB).
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 | |
# | |
# randomfiles | |
# | |
# Little bash script which generates some random files (max file size ~3 MB). | |
# | |
# Copyright(c) 2014 André König <[email protected]> | |
# MIT Licensed | |
# | |
if [ -z "$1" ] | |
then | |
echo -e "Please define how many files you want to generate.\n"; | |
echo -e " $ randomfiles 10\n"; | |
fi | |
len=$1; | |
i=1; | |
while [[ $i -le $len ]]; do | |
echo -e "Generating $i/$len\n"; | |
dd bs=1024 count=$(($RANDOM / 10)) skip=$RANDOM if=/dev/urandom of=randomfile.$i; | |
echo -e "done!\n" | |
let "i += 1"; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment