📄 showimage
字号:
#!/bin/sh# Copyright (c) 1996 H&L Software, Inc.# Copyright (c) 1994 HaL Computer Systems, Inc.# if at least one parameter, see if it is the image type, which has# the form 'image/<type>'TYPE='unknown'if [ $# -ge 1 ]; then if [ "`echo $1 | cut -d'/' -f1`" = "image" ]; then TYPE=`echo $1 | cut -d'/' -f2` shift fifi# check for input file nameif [ $# -eq 0 ]; then STDIN=1 FILE="your file"else STDIN=0 FILE=$1fi# make sure /usr/bin/X11 is in the search pathif [ `echo "$PATH" | grep -c "/usr/bin/X11"` -eq 0 ]; then PATH=$PATH:/usr/bin/X11fi# process according to image typeFILTER=""case $TYPE inxwd | x-xwd) if [ `type xwud 2>&1 | cut -d' ' -f2` = "not" ]; then echo "ERROR: Can't find the 'xwud' program to show $FILE." exit 1 fi if [ $STDIN -eq 1 ]; then cat - | xwud else xwud -in $FILE fi exit $? ### DONE ### ;;xbitmap | x-xbitmap | xbm | x-xbm) TYPE=xbm ;;pgm | x-pgm) if [ `type pgmtopbm 2>&1 | cut -d' ' -f2` = "not" ]; then echo "ERROR: Can't find the 'pgmtopbm' program to show $FILE." exit 1 fi FILTER="pgmtopbm" ;;xpm | x-xpm | x-xpixmap) if [ `type xpmtoppm 2>&1 | cut -d' ' -f2` = "not" ]; then echo "ERROR: Can't find the 'xpmtoppm' program to show $FILE." exit 1 fi FILTER="xpmtoppm" ;;*) # GIFs, JPEGs, etc. ;;esac# find a viewer programVIEWER=""VARGS=""if [ `type xloadimage 2>&1 | cut -d' ' -f2` = "is" ]; then VIEWER=xloadimagefiif [ "$TYPE" != "xbm" -a `type xv 2>&1 | cut -d' ' -f2` = "is" ]; then VIEWER=xv VARGS="-perfect"fiif [ `type display 2>&1 | cut -d' ' -f2` = "is" ]; then VIEWER=display VARGS="-colormap Private" if [ "$TYPE" = "xbm" ]; then TMP=/tmp/showxbm$$ echo "#define display seems to need a # on the first line" > $TMP if [ $STDIN -eq 1 ]; then cat - >> $TMP $STDIN = 0 else cat $FILE >> $TMP FILE=$TMP fi fifiif [ "$VIEWER" = "" ]; then echo "ERROR: Can't find any viewer program to show $FILE." exit 1fiif [ $STDIN -eq 1 ]; then if [ "$FILTER" = "" ]; then $VIEWER - else cat - | $FILTER | $VIEWER - fielse if [ "$FILTER" = "" ]; then $VIEWER $FILE else $FILTER $FILE | $VIEWER - fifiRC=$?if [ "$TMP" != "" ]; then rm $TMPfiexit $RC
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -