Mail subject splitted


 
Thread Tools Search this Thread
Operating Systems AIX Mail subject splitted
# 1  
Old 09-16-2015
Mail subject splitted

Hi
I have a script that is sending mail and it was working fine. But the last time it run, it gave some errors. It look like the subject was split into many receiver. I am on AIX 6.1.

Code:
#!/bin/ksh
#
HOSTNAME=`which hostname`
MACHINE=`${HOSTNAME}`
# E-mail to inform hci of a stop
echo "### HCI Stop script beginning execution ###" | mail -s "Starting hci_stop on ${MACHINE}" hci

The output was redirected in a log file. Here is what was found in that log file:
Code:
axbe04... User unknown
hci_stop... User unknown
on... User unknown

I received the mail but the subject was only "Starting"

It is like the double quote was ignored and mail was thinking that "hci_stop on ${NOMMACHINE}" where the receivers.

Any ideas ?
Thanks

Last edited by Scrutinizer; 09-17-2015 at 04:55 PM.. Reason: Please wrap commands and data in CodeTags
# 2  
Old 09-16-2015
Could mail be some sort of wrapper script or alias in this context?
# 3  
Old 09-16-2015
Instead of:
Code:
HOSTNAME=`which hostname`
MACHINE=`${HOSTNAME}`

Try:
Code:
HOSTNAME=$(hostname)
MACHINE=${HOSTNAME}


Last edited by Scrutinizer; 09-16-2015 at 09:13 PM..
# 4  
Old 09-17-2015
No mail is not wrapper script or alias in this context.

---------- Post updated at 03:00 PM ---------- Previous update was at 02:58 PM ----------

These line of code are working fine. The 'MACHINE' variable is a good value.
# 5  
Old 09-17-2015
cat -v scriptfile to see if there's any odd characters in it
# 6  
Old 09-17-2015
"send the cat to the vet"

Code:
cat -vet scriptfile

;0)
# 7  
Old 09-18-2015
In the environment where:
Code:
mail -s "three word subject" user@company.com

delivers an email with the subject three, what output do you get from the command:
Code:
type mail

and from the command:
Code:
printf '%s\n' "$IFS" "$PATH" "$SHELL" | od -bc

This User Gave Thanks to Don Cragun For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep the last line and put on mail subject

I have mail: cat /home/oracle/scripts/dbsizedaily.txt | mail -s "$TODAY: PROD DB Size" $RECIPIENTS I like to get and put USED_GB and %USED of the very last row from /home/oracle/scripts/dbsizedaily.txt. /home/oracle/scripts/dbsizedaily.txt has : DATE TIME TOTAL_GB USED_GB ... (6 Replies)
Discussion started by: Daniel Gate
6 Replies

2. Shell Programming and Scripting

Subject line missing while sending mail

Hi, I have below script PROJECT_NAME=UDL/UDL_Weekly sub= echo ${PROJECT_NAME}|cut -d "/" -f2 cat pr.sh|mail -s "`hostname`: $sub failed" sonu.pal@xyz.com While running the script I am receiving the subject line in mail as " podetlsapp01: failed' instead of " podetlsapp01: ... (1 Reply)
Discussion started by: sonu_pal
1 Replies

3. Shell Programming and Scripting

adding hostname and date in subject of the mail

Hi Team, I coded my code to send mail to some reciepents with subject and date. Can somebody suggest me how to add host name to subject ? and the below code is correct for date ? my aim is to send mail with "subject in < hostname> on <date>".When i execute this script on my server its hung... (3 Replies)
Discussion started by: rocking77
3 Replies

4. Shell Programming and Scripting

mail: subject and body text

HI, After giving the mail -e name@domain.com its asking the subject : after this its enter in to the body of the mail i.e. (in edit mode) How to end this edit process to send mail ? (2 Replies)
Discussion started by: thelakbe
2 Replies

5. UNIX for Dummies Questions & Answers

mail -s not showing subject on emails

Hi, I have a cron job that creates backups nightly and sends me an email with output from the script. I'm recieving the email and the output; however, the subject field is always empty. Here is what I have in my crontab 00 23 * * * sh /test_backup/test_script | mail -s "Backups"... (2 Replies)
Discussion started by: orahi001
2 Replies

6. UNIX for Advanced & Expert Users

date need to be add in the subject of the mail.

Hi Am fetching a weekly report pf data..once i fetched the data i need a sent report by mail. In the subject of that mail i want to sent a message like.. SUBJECT :The report had been fetched from (01/12/08 to 07/12/08). I need to send a report like this every week with that particular... (2 Replies)
Discussion started by: bobprabhu
2 Replies

7. Shell Programming and Scripting

sort mail based on subject in unix.

Hi, I have a complicated requirement.I need to search for a particular pattern in the subject of incoming mail to a set of users and need to save the content of the mail in a file which will be uploaded to a file server. I have a perl script to do the upload.I need a script to sort the mail... (2 Replies)
Discussion started by: sriram.s
2 Replies

8. UNIX for Dummies Questions & Answers

How to set Subject in 'mail' ?

Hi, I am trying to send some file to some mail ids using mail command in UNIX. Now the issue is I am not able to find how to add "Subject text" to the command. So I am using command like "mail abc@yahoo.com < file_name" Now if I use simple mail command I can set subject text by using... (2 Replies)
Discussion started by: hkapil
2 Replies

9. UNIX for Dummies Questions & Answers

Mail subject output of script

I am new to this site so please bear with my ignorances. I have started playing with mail on AIX 4.3.3 with many successes (thanks to this site) but am now stuck. I want to send a mail with the subject as the result of a script, eg. I want the mail body to read as the output from 'df -k... (4 Replies)
Discussion started by: kiano
4 Replies

10. UNIX for Dummies Questions & Answers

Send a mail with a subject and an attachement

Dear All: I want to send a message to a list of people with a subject and an attachement, currently I am using the following command into a shell script: uuencode $FILENAME.gz $FILENAME.gz | mail john.kennedy@mycompany.com m.m@mycompany.com With this command I can send the message for a... (1 Reply)
Discussion started by: josecollantes
1 Replies
Login or Register to Ask a Question