From 701215724afae290d5cab3ce63bb5805673738f6 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 6 Apr 2016 17:45:29 -0400 Subject: [PATCH] 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 d659e39e1374..c0f30e307304 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 " 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 (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} ]] \ -- 2.26.2