Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with spacing in text out turn

Status
Not open for further replies.

chris01010

Programmer
Jan 29, 2004
25
GB
Hi guys,
Just got the attached script to run, which basically sends an email to a recipitent when an error occurs, and unfortunately the output contains a space as below. Any ideas?

Database reconciliation between Tandem and Unix has failed.
Please see the attached file(s).
You can investigate server"



body="Database reconciliation between Tandem and Unix has failed.\r
Please see the attached file(s).\r
You can investigate server"

Cheers

Chris
 
Hi Chris,

In most of our scripts we produce log-files and some times mail-message files (echo'ing text and appending it to the file). At the end of the script, if appropriate, we e-mail the log-file or message-file as follows:

cat <file> | mailx -s "<subject>" <mail-addressee(s)>

I hope that helps.

Mike
 
Hi Chris,

You could just echo the variable into mailx:

echo ${body} | mailx -s "<subject>" <mail-addressee(s)>

By the way in Solaris the \r means carriage return, instead you should be using \n which means new-line.

I hope that helps.

Mike
 
Hi:

The Unix here document will also work.

mailx -s "<subject>" <mail-addressee> <<MSG

This mails text
MSG

If you've already collected text in a file you can do this:

mailx -s "<subject>" <mail-addressee> <<MSG
$(cat myfile)
MSG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top