#This one works with the patched version of tar:
# *.tar.bz2) tyvvf $1 2>/dev/null ;;
*.tar.gz) tar tzvvf $1 2>/dev/null ;;
*.tar.Z) tar tzvvf $1 2>/dev/null ;;
*.tar.z) tar tzvvf $1 2>/dev/null ;;
*.bz2) bzip2 -dc $1 2>/dev/null ;; # View compressed files correctly
*.Z) gzip -dc $1 2>/dev/null ;;
*.z) gzip -dc $1 2>/dev/null ;;
*.gz) gzip -dc $1 2>/dev/null ;;
*.zip) unzip -l $1 2>/dev/null ;;
*.1|*.2|*.3|*.4|*.5|*.6|*.7|*.8|*.9|*.n|*.man) FILE=`file -L $1` ; # groff src
FILE=`echo $FILE | cut -d ' ' -f 2`
if [ "$FILE" = "troff" ]; then
groff -s -p -t -e -Tascii -mandoc $1
fi ;;
*) cat $1 2>/dev/null ;;
# *) FILE=`file -L $1` ; # Check to see if binary, if so -- view with 'strings'
# FILE1=`echo $FILE | cut -d ' ' -f 2`
# FILE2=`echo $FILE | cut -d ' ' -f 3`
# if [ "$FILE1" = "Linux/i386" -o "$FILE2" = "Linux/i386" \
# -o "$FILE1" = "ELF" -o "$FILE2" = "ELF" ]; then
# strings $1
# fi ;;
esac
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
6. 使用 bzip2 来结合 emacs
6.1 为每个人改变 emacs:
我写了下面的给 jka-compr.el 用的修补,它会加入 bzip2 成为自动压缩模式。
除外条款: 我只在 emacs-20.2上试过这个,但是我也找不到有啥麽理由来相信同样的方法却不能在其他版本上使用的。
使用它,
到 emacs-20.2/lisp 原始程式码目录□ (看你在哪儿 untarred 它的)
把下面的修补做成叫 jka-compr.el.diff 的档案(全放在这档案□ )。
然後执行
patch < jka-compr.el.diff
启动 emacs,再执行
M-x byte-compile-file jka-compr.el
离开 emacs。
把它原来的 jka-compr.elc 放到安全的地方以防有臭虫时备用。
用新的 jka-compr.elc来代替它。
好好玩吧!
--- jka-compr.el Sat Jul 26 17:02:39 1997
jka-compr.el.new Thu Feb 5 17:44:35 1998
@@ -44,7 44,7 @@
;; The variable, jka-compr-compression-info-list can be used to
;; customize jka-compr to work with other compression programs.
;; The default value of this variable allows jka-compr to work with
-;; Unix compress and gzip.
;; Unix compress and gzip. David Fetter added bzip2 support :)
;;
;; If you are concerned about the stderr output of gzip and other
;; compression/decompression programs showing up in your buffers, you
@@ -121,7 121,9 @@
;;; I have this defined so that .Z files are assumed to be in unix
-;;; compress format; and .gz files, in gzip format.
;;; compress format; and .gz files, in gzip format, and .bz2 files,
;;; in the snappy new bzip2 format from http://www.muraroa.demon.co.uk.
;;; Keep up the good work, people!
(defcustom jka-compr-compression-info-list
;;[regexp
;; compr-message compr-prog compr-args
@@ -131,6 133,10 @@
"compressing" "compress" ("-c")
"uncompressing" "uncompress" ("-c")
nil t]
["\\.bz2\\'"
"bzip2ing" "bzip2" ("")
"bunzip2ing" "bzip2" ("-d")
nil t]
["\\.tgz\\'"
"zipping" "gzip" ("-c" "-q")
"unzipping" "gzip" ("-c" "-q" "-d")
6.2 为某人改变 emacs:
这次要谢谢 Ulrik Dickow, ukd@kampsax.dk,他是Kampsax Technology的系统程式设计师 :
为了让非 sysadmin 的朋友可以自动地使用 bzip2,只需在你的 .emacs 档案□加上下列东东。
;; Automatic (un)compression on loading/saving files (gzip(1) and similar)
;; We start it in the off state, so that bzip2(1) support can be added.
;; Code thrown together by Ulrik Dickow for ~/.emacs with Emacs 19.34.
;; Should work with many older and newer Emacsen too. No warranty though.
;;
(if (fboundp 'auto-compression-mode) ; Emacs 19.30
(auto-compression-mode 0)
(require 'jka-compr)
(toggle-auto-compression 0))
;; Now add bzip2 support and turn auto compression back on.
(add-to-list 'jka-compr-compression-info-list
["\\.bz2\\(~\\|\\.~[0-9] ~\\)?\\'"
"zipping" "bzip2" ()
"unzipping" "bzip2" ("-d")
nil t])
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




