################################################## # KSH Function: send_email # Author : Rainer Raab ([email protected]) # Date : 11/28/2000 ################################################## # Description : Sends an e-mail message to a # list of recipients. The message body contains # the hostname and timestamp. Lowercase letters # are automatically converted to uppercase, to # allow for readability on text pagers. ################################################## # Usage: # EMAIL_LIST="email_address1 email_address2 ..." # EMAIL_SUBJECT="Subject" # EMAIL_MESSAGE="Message body" ################################################## function send_email { for EMAIL in $EMAIL_LIST; do SYSTIME=$(date '+%m-%d-%y %H:%M') SYSHOST=$(hostname) SUBJECT=$(printf "$EMAIL_SUBJECT"|tr "[:lower:]" "[:upper:]") printf "$SYSHOST MSG ($SYSTIME): $EMAIL_MESSAGE\n"|tr "[:lower:]" \ "[:upper:]"|mailx -s " $SUBJECT" $EMAIL done }
Creating Global Functions with the Korn Shell
Related Reading
More Insights
INFO-LINK
To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy. | |