📄 sendmailto.sh
字号:
#!/bin/ksh## SAMPLE NAME: sendMailTo## FUNCTIONS: This sample shell script sends a message to the addresses# read through stdin. For example, the compOwners shell# script can be run and the output can be piped to sendMailTo# in order to send a message to all component owners.## USAGE: sendMailTo messagefile subject## ENVIRONMENT# VARIABLE(S):## ORIGINS: 27## 5765-039 (C) COPYRIGHT International Business Machines Corp. 1991,1993# 5765-207 (C) COPYRIGHT International Business Machines Corp. 1993# 5765-202 (C) COPYRIGHT International Business Machines Corp. 1993# 5622-063 (C) COPYRIGHT International Business Machines Corp. 1993# 5765-069 (C) COPYRIGHT International Business Machines Corp. 1991,1993# All Rights Reserved# Licensed Materials - Property of IBM## US Government Users Restricted Rights - Use, duplication or# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.### NOTICE TO USERS OF THE SOURCE CODE EXAMPLES## INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THE SOURCE CODE# EXAMPLES, BOTH INDIVIDUALLY AND AS ONE OR MORE GROUPS, "AS IS" WITHOUT# WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT# LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A# PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE# OF THE SOURCE CODE EXAMPLES, BOTH INDIVIDUALLY AND AS ONE OR MORE GROUPS,# IS WITH YOU. SHOULD ANY PART OF THE SOURCE CODE EXAMPLES PROVE# DEFECTIVE, YOU (AND NOT IBM OR AN AUTHORIZED RISC System/6000* WORKSTATION# DEALER) ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR OR# CORRECTION.## * RISC System/6000 is a trademark of International Business Machines# Corporation.## /usr/lpp/cmvc/samples/sendMailTo#if [ $# -eq 0 ]then echo "\nusage: $0 messagefile subject\n" echo "This sample shell script sends a message to the addresses" echo "read through stdin. For example, the compOwners shell script " echo "can be invoked and the output can be piped to sendMailTo" echo "in order to send a message to all component owners.\n" exit 1ficleanup(){ rm -f /tmp/msg$$ 2>/dev/null exit 1}trap 'echo "\n$0: Interrupted."; cleanup; exit 1' 2 3 15if [ -n "$2" ]then echo "Subject: $2\n" | cat - $1 >/tmp/msg$$else cat $1 >/tmp/msg$$fiwhile read addressdoecho $address/usr/lib/sendmail -odq -oeq $address < /tmp/msg$$donecleanup
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -