- #!/bin/bash
-
-
# Invoke appropriate command accroding the last argument's suffix
-
# Using mailcap may be more reasonable
-
-
function run() {
-
f=$( (eval echo \${$#}) | tr [:upper:] [:lower] )
-
-
case $f in
-
*.pdf) prg=xpdf;;
-
*.doc) prg=lowriter ;;
-
*.xls) prg=localc ;;
-
*.c | *.h | *.asm) prg=vim ;;
-
*.html | *.htm) prg=firefox;;
-
*.rar | *.zip) prg=xarchive;;
-
*.png | *.jpg| *.jpeg) prg=feh ;;
-
*)
-
echo "Can't guess which command to invoke"
-
echo "Press Y, try vim"
-
read -n 1 -t 2 key
-
if [[ $key = "Y" || $key = "y" ]]; then
-
prg=vim
-
else
-
exit -1
-
fi
-
;;
-
esac
-
-
exec $prg $@
-
}
-
-
run $@
-
-
# vim: set tabstop=4: #
lowriter, localc 等击键在TAB 补全的时候因为匹配项多,所以写了一个 r 脚本来偷懒。用于减少击键次数...
阅读(2599) | 评论(0) | 转发(0) |