diff options
author | Aaron Ball <nullspoon@iohq.net> | 2015-10-01 23:35:03 -0600 |
---|---|---|
committer | Aaron Ball <nullspoon@iohq.net> | 2015-10-01 23:35:03 -0600 |
commit | 73341722be0c2d5d71283c2044a422794507717a (patch) | |
tree | 3f41b14128127e81cc78d0d5070387edbbf995ea | |
parent | 4badddd80e18697830cecf19bbc5bbc5e6adf0d7 (diff) | |
download | palindrome_finder-73341722be0c2d5d71283c2044a422794507717a.tar.gz palindrome_finder-73341722be0c2d5d71283c2044a422794507717a.tar.xz |
Added gendata script
This script will generate random data to be used for testing the
palindrome finder program.
-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 |