From eba64f5df86749398e90289ed4d0400131e65815 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Wed, 3 Oct 2012 16:29:01 -0400 Subject: [PATCH] added pager at end, so we don't have to always combine the listing with less. --- scripts/archival/listarch.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/archival/listarch.sh b/scripts/archival/listarch.sh index 88cc9678..c21d5d68 100644 --- a/scripts/archival/listarch.sh +++ b/scripts/archival/listarch.sh @@ -24,6 +24,16 @@ if [ ! -f "$archive_file" ]; then exit 1 fi +if [ -z "$PAGER" ]; then + PAGER=$(which less) + if [ -z "$PAGER" ]; then + PAGER=$(which more) + if [ -z "$PAGER" ]; then + PAGER="cat" + fi + fi +fi + # save where we started out. ORIGINATING_FOLDER="$( \pwd )" @@ -45,12 +55,12 @@ if [[ $archive_file =~ .*\.tar$ \ || $archive_file =~ .*\.tgz$ \ || $archive_file =~ .*\.ova$ \ ]]; then - tar -tf $archive_file + tar -tf $archive_file | $PAGER elif [[ $archive_file =~ .*\.zip$ \ || $archive_file =~ .*\.epub$ \ || $archive_file =~ .*\.odt$ \ || $archive_file =~ .*\.jar$ \ || $archive_file =~ .*\.war$ \ ]]; then - unzip -v $archive_file + unzip -v $archive_file | $PAGER fi -- 2.34.1