X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Farchival%2Flistarch.sh;h=c21d5d689a07669bfafc6c6bf15b2a7bbaae3e42;hb=f1391991b594a5dda9b5e7950588fa051b9398fa;hp=88cc9678820f27857bcf1bde600aaf2b63de3495;hpb=37ad93186a66429fde4b05bb25cd1f6beb757241;p=feisty_meow.git 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