diff options
Diffstat (limited to 'jotpass.ksh')
-rwxr-xr-x | jotpass.ksh | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/jotpass.ksh b/jotpass.ksh index c1b14aa..4f3efe4 100755 --- a/jotpass.ksh +++ b/jotpass.ksh @@ -1,6 +1,7 @@ -#! /bin/ksh +#! /usr/bin/env oksh +# shellcheck shell=ksh -# Copyright (c) 2021 Stefan Kreutz <mail@skreutz.com> +# Copyright (c) 2021, 2024 Stefan Kreutz <mail@skreutz.com> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -49,6 +50,11 @@ jot -r $((groups*width)) 0 $((symbols-1)) | fold -w "$width" | paste -s -d "$separator" - +if [ "$( uname )" == "FreeBSD" ] ; then + # FreeBSD's paste(1) swallows the final newline. + printf '\n' +fi + if [ $verbosity -gt 0 ]; then entropy="$( printf 'e = (%d * %d * l(%d))/l(2); scale = 0; e/1\n' "$groups" "$width" "$symbols" | bc -l )" print -u2 -- "The generated password has an entropy of ${entropy} bits." |