freebsd-dev/usr.bin/less/lesspipe.sh
Fernando Apesteguía e6ffcf4ac7 zless(1): handle uncompressed files
In the manual page for zmore(1) and zless(1) it is said that zless(1) is
equivalent to zmore(1) except that it uses less(1) as a pager. However
zmore(1) is able to handle uncompressed files transparently while zless(1)
is not.

Add another case to the switch in lesspipe.sh to handle non-compressed files.

PR:		196437
Reported by:	marquis@roble.com
Approved by:	mjg@
Differential Revision: https://reviews.freebsd.org/D38674
2023-02-20 11:15:09 +01:00

31 lines
425 B
Bash

#! /bin/sh
# ex:ts=8
# $FreeBSD$
case "$1" in
*.zip)
exec unzip -c "$1" 2>/dev/null
;;
*.Z)
exec uncompress -c "$1" 2>/dev/null
;;
*.gz)
exec gzip -d -c "$1" 2>/dev/null
;;
*.bz2)
exec bzip2 -d -c "$1" 2>/dev/null
;;
*.xz)
exec xz -d -c "$1" 2>/dev/null
;;
*.lzma)
exec lzma -d -c "$1" 2>/dev/null
;;
*.zst)
exec zstd -d -q -c "$1" 2>/dev/null
;;
*) exec cat "$1" 2>/dev/null
;;
esac