commit: 701215724afae290d5cab3ce63bb5805673738f6
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 6 21:45:29 2016 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Apr 6 22:09:25 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=70121572
sys-apps/less: lesspipe: handle all non-regular files in main code
sys-apps/less/files/lesspipe.sh | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/sys-apps/less/files/lesspipe.sh b/sys-apps/less/files/lesspipe.sh
index d659e39..c0f30e3 100755
--- a/sys-apps/less/files/lesspipe.sh
+++ b/sys-apps/less/files/lesspipe.sh
@@ -59,6 +59,15 @@ lesspipe() {
[[ ${match} == *.${ignore} ]] && exit 0
done
+ # Handle non-regular file types.
+ if [[ -d $1 ]] ; then
+ ls -alF -- "$1"
+ return
+ elif [[ ! -f $1 ]] ; then
+ stat "$1"
+ return
+ fi
+
case "${match}" in
### Doc files ###
@@ -234,14 +243,12 @@ lesspipe() {
if [[ -z $1 ]] ; then
echo "Usage: lesspipe <file>"
elif [[ $1 == "-V" || $1 == "--version" ]] ; then
- Id="cvsid"
cat <<-EOF
- $Id$
- Copyright 2001-2013 Gentoo Foundation
+ lesspipe (git)
+ Copyright 2001-2016 Gentoo Foundation
Mike Frysinger <[email protected]>
(with plenty of ideas stolen from other projects/distros)
-
EOF
less -V
elif [[ $1 == "-h" || $1 == "--help" ]] ; then
@@ -265,8 +272,6 @@ elif [[ $1 == "-h" || $1 == "--help" ]] ; then
Run 'less --help' or 'man less' for more info.
EOF
-elif [[ -d $1 ]] ; then
- ls -alF -- "$1"
else
recur=0
[[ -n ${LESSDEBUG} ]] \