Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re[2]: awk and ksh question - solved
It still seems like overkill to me. I just put the pager addresses in a alias in either /etc/aliases or .mailrc as a list for dba_oncall, eliminating the need for db_oncall.txt.
In /etc/aliases:
db_oncall: 9991234567_at_pageme.co, lisa.koivu_at_efairfield.com
Or in .mailrc
alias db_oncall 9991234567_at_pageme.co lisa.koivu_at_efairfield.com
Then when I want to send them a file I do:
$ cat FILE_TO_SEND | mail -s FILE_TO_SEND dba_oncall
No messing with awk or special characters, or worrying what shell it runs in, I know the mail aliases live where all the other mail aliases live so I don't have to go hunting for special files when something needs to change.
KL> Stephen, I'm aware of the syntax. My question was, WHY?? Robert hit it on KL> the head, awk and ksh are both interpreting $1.
KL> Anyway I solved the problem with shift, like this. Thanks to all that KL> replied.
KL> export PAGER= KL> export PAGERFILE=dba_oncall.txt KL> export FILE_TO_SEND=$1 KL> shift ;
KL> if [[ $# = 1 ]]
KL> then
KL> export SUBJECT="Subject: $1";
print $SUBJECT >> $$.log
KL> shift ;
KL> fi;
cat $FILE_TO_SEND >>> $$.log
KL> for PAGER in ${*-$(awk '!/^#/ {print $1}' dba_oncall.txt)}; KL> do
KL> print $PAGER KL> sendmail $PAGER < $$.log
KL> done
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Robert Eskridge
INET: bryny_at_dfweahs.net
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services ---------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Tue Feb 04 2003 - 08:10:48 CST
![]() |
![]() |