在这个程序中,我将我的邮件内容分类到程序中,它应该只显示提到的字段(发件人:收件人:日期:主题:)和收件箱中每封电子邮件的邮件正文。我还是 BASH 的新手,所以如果你有答案,请解释一下。
#! /bin/bash
IFS=" "
read first rest
while [ $? -eq 0 -a "$first" == "From" ] ; do
echo $first" "$rest
:
read first rest
###################################
#
while [ ! -z $first ] ; do
#
case "$first" in
"Date:" )
echo $first$rest
:
;;
"From:" )
echo $first$rest
:
;;
"To:" )
echo $first$rest
:
;;
"Subject:" )
echo $first$rest
:
;;
* )
:
;;
esac
read first rest
done
###################################
#
##
##
:
read first rest
###################################
#
while [ ! -z $first ] ; do
:
echo $first" "$rest
read first rest
done
read first rest
done
:
exit