diff options
-rwxr-xr-x | gendata.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gendata.sh b/gendata.sh new file mode 100755 index 0000000..8241b97 --- /dev/null +++ b/gendata.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +if [[ -z ${1} ]]; then + echo "Please provide a character count to generate"; + return 1 +fi + +# Create data dir if doesn't exist +datadir='./data' +if [[ ! -d ${datadir} ]]; then + mkdir ${datadir} +fi + + +charcount=${1} +head -c ${charcount} /dev/urandom | base64 | tr -cd 'a-zA-Z0-9' | head -c ${charcount} > ${datadir}/${charcount}.txt |