summaryrefslogtreecommitdiff
path: root/jotpass.ksh
diff options
context:
space:
mode:
authorStefan Kreutz <mail@skreutz.com>2024-05-12 21:49:47 +0200
committerStefan Kreutz <mail@skreutz.com>2024-05-12 21:49:47 +0200
commit3aaebdb964ecb228bfc161e822905013e8dacc27 (patch)
tree442d845cb58a77feeeb3be5ee9fab83defbf7b25 /jotpass.ksh
parent41134866c2646092c7baa9e0e545c50354aab934 (diff)
downloadjotpass-3aaebdb964ecb228bfc161e822905013e8dacc27.tar
Port to FreeBSDHEADmain
Diffstat (limited to 'jotpass.ksh')
-rwxr-xr-xjotpass.ksh10
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."
Generated by cgit. See skreutz.com for my tech blog and contact information.