diff options
-rwxr-xr-x | bin/bin/makepass.sh | 12 | ||||
-rwxr-xr-x | bin/bin/makepass.zsh | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/bin/bin/makepass.sh b/bin/bin/makepass.sh index 0877cc9..6b80420 100755 --- a/bin/bin/makepass.sh +++ b/bin/bin/makepass.sh @@ -26,7 +26,7 @@ if [ ! -z "$1" ] && [ ! ${1:-0} -gt 0 ]; then printf '%s\n' 'not a number above _RANDOM() { RANDOM=0 while [ ! "$RANDOM" = "${RANDOM#0}" ]; do - RANDOM=$(< /dev/urandom tr -cd "[:digit:]" | head -c 8) + RANDOM=$(head -n100 /dev/urandom | tr -cd "[:digit:]" | tail -c 8) done printf '%s\n' "$RANDOM" return 0 @@ -47,14 +47,14 @@ _random() ( if [ "$fla" = "true" ]; then if [ $len -le 2 ]; then - string="$(< /dev/urandom tr -cd '[:alpha:]' | head -c $len)" + string="$(head -n10 /dev/urandom | tr -cd '[:alpha:]' | tail -c $len)" else - string="$(< /dev/urandom tr -cd '[:alpha:]' | head -c 1)" - string="${string}$(< /dev/urandom tr -cd "$chars" | head -c $((len-2)))" - string="${string}$(< /dev/urandom tr -cd '[:alpha:]' | head -c 1)" + string="$(head -n10 /dev/urandom | tr -cd '[:alpha:]' | tail -c 1)" + string="${string}$(head -n100 /dev/urandom | tr -cd "$chars" | tail -c $((len-2)))" + string="${string}$(head -n10 /dev/urandom | tr -cd '[:alpha:]' | tail -c 1)" fi else - string="$(< /dev/urandom tr -cd "$chars" | head -c $len)" + string="$(head -n100 /dev/urandom | tr -cd "$chars" | tail -c $len)" fi printf '%s\n' "$string" diff --git a/bin/bin/makepass.zsh b/bin/bin/makepass.zsh index 0579503..bba6097 100755 --- a/bin/bin/makepass.zsh +++ b/bin/bin/makepass.zsh @@ -25,7 +25,7 @@ emulate -L zsh # Function to create random stuff function _random() { setopt local_options - RANDOM=$(< /dev/urandom tr -cd "[:digit:]" | head -c 8) # seed RANDOM + RANDOM=$(head -n 100 /dev/urandom | tr -cd "[:digit:]" | tail -c 8) # seed RANDOM # Default is a number between 8 and 44 local -i len=$1 @@ -41,14 +41,14 @@ function _random() { if [[ $fla == true ]]; then if (( len <= 2 )); then - string="$(< /dev/urandom tr -cd '[:alpha:]' | head -c $len)" + string="$(head -n 10 /dev/urandom | tr -cd '[:alpha:]' | tail -c $len)" else - string="$(< /dev/urandom tr -cd '[:alpha:]' | head -c 1)" - string+="$(</dev/urandom tr -cd "$chars" | head -c $((len-2)))" - string+="$(</dev/urandom tr -cd '[:alpha:]' | head -c 1)" + string="$( head -n 10 /dev/urandom | tr -cd '[:alpha:]' | tail -c 1)" + string+="$(head -n 100 /dev/urandom | tr -cd "$chars" | tail -c $((len-2)))" + string+="$(head -n 10 /dev/urandom | tr -cd '[:alpha:]' | tail -c 1)" fi else - string="$(< /dev/urandom tr -cd "$chars" | head -c $len)" + string="$(head -n 100 /dev/urandom | tr -cd "$chars" | tail -c $len)" fi printf '%s\n' "$string"; return |