From 95f861f2af6858412445371c621ebd1a00e16f81 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Sat, 15 Feb 2020 20:58:21 +0200 Subject: Use tput or stty to get the terminal size --- slackupgrade | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'slackupgrade') diff --git a/slackupgrade b/slackupgrade index e4335a0..9be3e98 100644 --- a/slackupgrade +++ b/slackupgrade @@ -383,12 +383,13 @@ function disk_avail_size() { # Downloads all selected packages to the spool directory. function download_all() { info "downloading packages" - if [ ${COLUMNS:-0} -lt 10 ]; then + cols=$(tput cols 2>/dev/null || stty size 2>/dev/null | cut -d' ' -f2) + if [ ${cols:-0} -lt 10 ]; then progressbar=0 fi if [ $progressbar -eq 1 ]; then total=$(wc -l candidates | cut -d ' ' -f 1) - width=$(( $COLUMNS - 7 )) + width=$(( $cols - 7 )) fi i=0 cat candidates | -- cgit v1.2.1