wofr06 / lesspipe

lesspipe - display more with less
GNU General Public License v2.0
484 stars 51 forks source link

lesspipe.sh: in POSIX sh, ';;&' is not defined #129

Closed wileyhy closed 1 year ago

wileyhy commented 1 year ago

Hi, Should this issue be filed here, or do you know perhaps of someplace else where one might ...? https://github.com/gwsw/less/issues/369 Here's a cut-&-paste of the affected script.


 61   *.xz|*.lzma)  DECOMPRESSOR="xz -dc" ;;
 62   esac
 63   if [ -n "$DECOMPRESSOR" ] && $DECOMPRESSOR -- "$1" | file - | grep -q     troff; then
 64     $DECOMPRESSOR -- "$1" | manfilter -
 65     exit $? 
 66   fi ;;&
 67 *.[1-9n]|*.[1-9]x|*.man)
 68   if file "$1" | grep -q troff; then
 69     manfilter "$1"
 70     exit $?
 71   fi ;;&
 72 *.tar) tar tvvf "$1"; exit $? ;;
 73 *.tgz|*.tar.gz|*.tar.[zZ]) tar tzvvf "$1"; exit $? ;;
 74 *.tar.xz) tar Jtvvf "$1"; exit $? ;;
 75 *.xz|*.lzma) xz -dc -- "$1"; exit $? ;;
 76 *.tar.lz) tar --lzip -tvvf "$1"; exit $? ;;

This text is from /usr/bin/lesspipe.sh in "less-608-2.fc38.x86_64.rpm" on Fedora 38. Cheers, Wiley

wofr06 commented 1 year ago

The lesspipe you are referring to is a quite different script. Discussions on this script do not belong here. Anyway, even if you are using Fedora, you can install the lesspipe.sh from here. Which one is then used is determined by the contents of the environment variable LESSOPEN. The Fedora script tries to interpret the contents based on the file ending, while the script here chooses the filtering algorithm based on the file contents if possible. Usually that leads to more precise results.

wileyhy commented 1 year ago

Reported this bug on Red Hat bugzilla. https://bugzilla.redhat.com/show_bug.cgi?id=2210583