diff options
author | Dennis Eriksen <d@ennis.no> | 2022-08-19 08:03:35 +0200 |
---|---|---|
committer | Dennis Eriksen <d@ennis.no> | 2022-08-19 08:03:35 +0200 |
commit | cd39f574714cebd33a21e1f6ae46757ca0cc09db (patch) | |
tree | 4014a04ff53266804fd4df58f54cf4ed5e8ea048 | |
parent | we no longer use github! (diff) | |
download | makepass-cd39f574714cebd33a21e1f6ae46757ca0cc09db.tar.gz |
makepass wasn't working on bsd (bsd-version of head didn't take -c as an
argument), so here's an updated version that runs on openbsd
-rwxr-xr-x | bin/bin/makepass | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/bin/makepass b/bin/bin/makepass index 25fce07..0ebc60b 100755 --- a/bin/bin/makepass +++ b/bin/bin/makepass @@ -29,16 +29,16 @@ function makepass { echo "Normal passwords:" for i in {1..10}; do [ "$1" = "" ] && l=$(shuf -i 8-44 -n 1) - < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-$l};echo; + head -n10 /dev/urandom | tr -dc _A-Z-a-z-0-9 | cut -c-${1:-$l}; done | column echo "" echo "Passwords with special characters:" for i in {1..6}; do [ "$1" = "" ] && l=$(shuf -i 16-64 -n 1) - first=$(< /dev/urandom tr -dc A-Za-z | head -c 1) - words=$(< /dev/urandom tr -dc '!#$%&/()=?+-_,.;:<>[]{}|\@*^A-Z-a-z-0-9' | head -c${1:-$l} | cut -c 3-) - last=$(< /dev/urandom tr -dc A-Za-z | head -c 1) + first=$(head -n10 /dev/urandom | tr -dc A-Za-z | cut -c-1) + words=$(head -n10 /dev/urandom | tr -dc '!#$%&/()=?+-_,.;:<>[]{}|\@*^A-Z-a-z-0-9' | cut -c-${1:-$l}) + last=$(head -n10 /dev/urandom | tr -dc A-Za-z | cut -c-1) echo "${first}${words}${last}" done | column |