From a08beb06acc286d3bee7716667be35e595c7ccf6 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 16 Aug 2017 10:05:00 +0100 Subject: [PATCH] allowed variable length width --- center80.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/center80.sh b/center80.sh index fc39dd9a..1c4935a2 100755 --- a/center80.sh +++ b/center80.sh @@ -26,6 +26,6 @@ set -euo pipefail textsize=${#1} # I want this to only match my hr() function, not 27" iMac 5K screens #width=$(tput cols) -width=80 +width="${2:-${WIDTH:-80}}" span=$((($width + $textsize) / 2)) printf "%${span}s\n" "$1"