diff options
author | Mike Frysinger <vapier@gentoo.org> | 2016-04-06 17:45:29 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2016-04-06 18:09:25 -0400 |
commit | 701215724afae290d5cab3ce63bb5805673738f6 (patch) | |
tree | 6b40b9077b5f7d8fb30ab8197af4c8ab799f966d /sys-apps/less | |
parent | sys-apps/less: drop old <481 versions (diff) | |
download | gentoo-701215724afae290d5cab3ce63bb5805673738f6.tar.gz gentoo-701215724afae290d5cab3ce63bb5805673738f6.tar.bz2 gentoo-701215724afae290d5cab3ce63bb5805673738f6.zip |
sys-apps/less: lesspipe: handle all non-regular files in main code
Diffstat (limited to 'sys-apps/less')
-rwxr-xr-x | sys-apps/less/files/lesspipe.sh | 17 |
1 files 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 <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 <vapier@gentoo.org> (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} ]] \ |