chiark / gitweb /
el/dot-emacs.el (mdw-fontify-rust): Fix integer literal syntax.
[profile] / bin / lesspipe.sh
1 #!/bin/sh
2 # This is a preprocessor for 'less'.  It is used when this environment
3 # variable is set:   LESSOPEN="|lesspipe.sh %s"
4
5 lesspipe() {
6   case "$1" in
7   *.tar) tar tvvf $1 2>/dev/null ;; # View contents of .tar and .tgz files
8   *.tgz|*.tar.gz|*.tar.Z|*.tar.z) gzip -dc $1 | tar tvvf - 2>/dev/null ;;
9   *.tar.bz2) bzip2 -dc $1 | tar tvvf - 2>/dev/null ;;
10   *.zip) unzip -l $1 2>/dev/null ;;
11   *.[1-9n]|*.man)
12     groff -te -Tascii -mandoc $1 ;;
13   *.[1-9].gz|*.man.gz)
14     gzip -dc $1 | groff -te -Tascii -mandoc ;;
15   *.Z|*.z|*.gz) gzip -dc $1  2>/dev/null ;; # View compressed files correctly
16   *.bz2) bzip2 -dc $1  2>/dev/null ;; # View compressed files correctly
17 #  *) FILE=`file -L $1` ; # Check to see if binary, if so -- view with 'strings'
18 #    FILE1=`echo $FILE | cut -d ' ' -f 2`
19 #    FILE2=`echo $FILE | cut -d ' ' -f 3`
20 #    if [ "$FILE1" = "Linux/i386" -o "$FILE2" = "Linux/i386" \
21 #         -o "$FILE1" = "ELF" -o "$FILE2" = "ELF" ]; then
22 #      strings $1
23 #    fi ;;
24   esac
25 }
26
27 lesspipe $1