大家好想写脚本(ksh)从包含成员数据的文件中逐行读取,需要每行连续发送一封电子邮件到同一个电子邮件地址
这是我走了多远:
js020:
setenv JS "js020"
jsbeg_msg.csh
# Input Files
setenv EMAIL_MSG_FILENAME "`gdg $DATADIR/abcemail -c`"
# Apply Overrides
source $SRCDIR/override.src
#Execute program
setenv SUBJECT " Recovery Notice"
for line in $(cat $EMAIL_MSG_FILENAME)
do
echo "$line"
echo "SENDING E-MAIL MESSAGE TO xxxx"
execpgm.csh '/usr/ucb/mail -s "$SUBJECT" xyz@abc.com < "$EMAIL_MSG_FILENAME"'
if ($status != 0) then
echo "Sending e-mail in Step " ${JS} " FAILED! "
exit (-1)
endif
done
# END OF JOB
eoj_msg.csh $0
exit(0)
答案 0 :(得分:0)
foreach Lineread(“cat $File_name
”)
setenv myline“$ Lineread”
execpgm.csh'echo“$ myline”| / usr / bin / mailx -s“Notice”xyz@abc.com'
if($ status!= 0)然后
echo“在步骤中发送电子邮件”$ {JS}“FAILED!”
退出(-1)
ENDIF
端