📄 uu
字号:
#!/bin/sh# Chapter 12 - Using getopts## This wrapper script around the uuencode command demonstrates the use# of the getopts command for parsing arguments in shell scriptsUSAGE="Usage: `basename $0` [-v] [-f] [filename] [-o] [filename]";VERBOSE=falsewhile getopts f:o:v OPTION ; do case "$OPTION" in f) INFILE="$OPTARG" ;; o) OUTFILE="$OPTARG" ;; v) VERBOSE=true ;; \?) echo "$USAGE" ; exit 1 ;; esacdoneshift `echo "$OPTIND - 1" | bc`if [ -z "$1" -a -z "$INFILE" ] ; then echo "ERROR: Input file was not specified." exit 1fiif [ -z "$INFILE" ] ; then INFILE="$1" ; fi: ${OUTFILE:=${INFILE}.uu}if [ -f "$INFILE" ] ; then if [ "$VERBOSE" = "true" ] ; then echo "uuencoding $INFILE to $OUTFILE... \c" fi uuencode $INFILE $INFILE > $OUTFILE ; RET=$? if [ "$VERBOSE" = "true" ] ; then MSG="Failed" ; if [ $RET -eq 0 ] ; then MSG="Done." ; fi echo $MSG fifiexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -