whole file content is coming in subject
Hi...I am trying to send a logfile details to my mail ID, For that I have made a shell script. for example plz see the below
echo Testing mail transfer > /var/log/backup/test
echo These are my files >> /var/log/backup/test
ls -ltrh >> /var/log/backup/test
mail -s "$(cat test)" $admin1 << END
It is working fine in cent OS, I mean, the first line of the file will be in subject box & remaining will be in the body, thats what I need.
But in ubuntu10.04 if I execute the same file, I will get the mail. but whole file content is coming as subject & only two or three words can be read. So plz tell me how can I modify the shell script to consider the first line of a file as subject & remaining as body.