add the scripts back

This commit is contained in:
Ivana Varekova 2007-02-07 12:55:35 +00:00
parent 61f34a88a4
commit 18956e29b9
3 changed files with 59 additions and 0 deletions

4
less.csh Executable file
View File

@ -0,0 +1,4 @@
# less initialization script (csh)
if ( -x /usr/bin/lesspipe.sh ) then
setenv LESSOPEN "|/usr/bin/lesspipe.sh %s"
endif

2
less.sh Executable file
View File

@ -0,0 +1,2 @@
# less initialization script (sh)
[ -x /usr/bin/lesspipe.sh ] && export LESSOPEN="|/usr/bin/lesspipe.sh %s"

53
lesspipe.sh Executable file
View File

@ -0,0 +1,53 @@
#!/bin/sh -
#
# To use this filter with less, define LESSOPEN:
# export LESSOPEN="|/usr/bin/lesspipe.sh %s"
lesspipe() {
case "$1" in
*.[1-9n]|*.man|*.[1-9n].bz2|*.man.bz2|*.[1-9].gz|*.[1-9]x.gz|*.[1-9].man.gz)
case "$1" in
*.gz) DECOMPRESSOR="gunzip -c" ;;
*.bz2) DECOMPRESSOR="bunzip2 -c" ;;
*) DECOMPRESSOR="cat" ;;
esac
if $DECOMPRESSOR -- "$1" | file - | grep -q troff; then
if echo "$1" | grep -q ^/; then #absolute path
man -- "$1" | cat -s
else
man -- "./$1" | cat -s
fi
else
$DECOMPRESSOR -- "$1"
fi ;;
*.tar) tar tvvf "$1" ;;
*.tgz|*.tar.gz|*.tar.[zZ]) tar tzvvf "$1" ;;
*.tar.bz2|*.tbz2) bzip2 -dc -- "$1" | tar tvvf - ;;
*.[zZ]|*.gz) gzip -dc -- "$1" ;;
*.bz2) bzip2 -dc -- "$1" ;;
*.zip) zipinfo -- "$1" ;;
*.rpm) rpm -qpivl --changelog -- "$1" ;;
*.cpi|*.cpio) cpio -itv < "$1" ;;
*.gif|*.jpeg|*.jpg|*.pcd|*.png|*.tga|*.tiff|*.tif)
if [ -x "`which identify`" ]; then
identify "$1"
else
echo "No identify available"
echo "Install ImageMagick to browse images"
fi ;;
*)
case "$1" in
*.gz) DECOMPRESSOR="gunzip -c" ;;
*.bz2) DECOMPRESSOR="bunzip2 -c" ;;
esac
if [ ! -z $DECOMPRESSOR ] ; then
$DECOMPRESSOR -- "$1" ;
fi
esac
}
if [ -d "$1" ] ; then
/bin/ls -alF -- "$1"
else
lesspipe "$1" 2> /dev/null
fi