From cd39f574714cebd33a21e1f6ae46757ca0cc09db Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Fri, 19 Aug 2022 08:03:35 +0200 Subject: 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 --- bin/bin/makepass | 8 ++++---- 1 file 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 -- cgit v1.2.3