#!/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