From 3aaebdb964ecb228bfc161e822905013e8dacc27 Mon Sep 17 00:00:00 2001 From: Stefan Kreutz Date: Sun, 12 May 2024 21:49:47 +0200 Subject: Port to FreeBSD --- jotpass.ksh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'jotpass.ksh') 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 +# Copyright (c) 2021, 2024 Stefan Kreutz # # 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." -- cgit v1.2.3