mimedecode

来自「Berkely的学生写的」· 代码 · 共 77 行

TXT
77
字号
#!/bin/sh# decode mime messages# $Id: mimedecode,v 1.1 1998/09/04 01:05:51 sveerara Exp $USAGE="Usage: mimedecode [-v] [-s src dir] [-d dest dir] [-f] [file]"    # check if an arg is given: ${1:?"$USAGE"} ;# check if metamail exitstype metamail > /dev/null 2>&1 ;if [ $? -ne 0 ] ; then    echo "ERROR: mimedecode requires metamail."    exit 1fi# initalize the variables to default values_MAILD="$HOME/Mail"_VERBSE=false;_SRCDIR="$_MAILD/inbox"    # scan the options# -f -> input file# -s -> source dir# -d -> dest dir# -v -> verbosewhile getopts f:s:d:v OPTION ; do    case "$OPTION" in	f) _INFILE="$OPTARG" ;;	s) _SRCDIR="$OPTARG" ;;	d) _DESDIR="$OPTARG" ;;	v) _VERBSE="true" ;;       \?) echo "$USAGE" ; exit 1 ;;    esacdone# check the source dirif [ ! -d "$_SRCDIR" ] ; then    echo "ERROR: Source directory, $_SRCDIR does nto exsist."    exit 1fishift `echo "$OPTIND - 1" | bc`# check the input file and destination dir: ${_INFILE:=${1:?"Input file not specified."}} \  ${_DESDIR:=mdout-${_INFILE}} ;# if the destintation dir doesn't exits make it if [ ! -d "$_DESDIR" ] ; then    mkdir "$_DESDIR";    if [ $? -ne 0 ] ; then	echo "ERROR: Could not make directory for decoding."	exit 1    fifiMETAMAIL_TMPDIR="$_DESDIR" ; export METAMAIL_TMPDIR ; _MM="metamail -x -y -w ${_SRCDIR}/${_INFILE}"if [ "$VERBSE" = "true" ] ; then     echo $_MM ; $_MM ; /bin/ls -l $_DESDIR ; else    echo $_MM ; $_MM > /dev/null 2>&1fiunset USAGE _INFILE _SRCDIR _DESDIR _VERBSE OPTION OPTARG OPTINDexit 0

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?