Created
April 14, 2015 12:16
Revisions
-
ericcholis created this gist
Apr 14, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ #!/usr/bin/env bash usage() { cat << EOF usage: random-string This script run the test1 or test2 over a machine. OPTIONS: -h Show this message -c Number of characters returned -s Number of random strings returned EOF } characters=32 strings=1 while getopts “hc:s:” OPTION do case $OPTION in h) usage exit 1 ;; c) characters=$OPTARG ;; s) strings=$OPTARG ;; esac done i=1 echo "" echo "Random Strings:" echo "--------------------------------------" while [[ $i -le $strings ]] do LC_CTYPE=C tr -dc A-Za-z0-9_\!\@\#\$\%\^\&\*\(\)-+= < /dev/urandom | head -c $characters | xargs ((i = i + 1)) done echo ""