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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date in e-mail 1

Status
Not open for further replies.

EdRev

Programmer
Aug 29, 2000
510
US
I have an FTP process that sends an e-mail confirmation:

mailx -s "File Transferred" -r username receipient@someco.com < sometext.txt

or

mailx -s "No File Transferred" -r username receipient@someco.com < othertext.txt

In the sometext/othertext.txt, I woukld like to put the date. Something like this:

(No) files were created on : $date

How can I pass the date into the text file?
How can I add the date on my subject - "No Files Transferred"

Any help will be greatly appreciated.
 
Code:
if [ "$FILES_CREATED" -gt 0 ]
then
    echo "The files were created on `date`" >> someone.txt
else
    echo "No files were created on `date`" >> someone.txt
fi

mailx -s "File Transferred: `date`" -r username receipient@someco.com < sometext.txt

--
-- GhodMode
 
Thanks to your immediate response.

I tried this:

mailx -s "File Transferred: `date`" -r username receipient@someco.com < sometext.txt

but it just added the text 'date' on the e-mail subject. ( is that a single quote enclosing the date?)

I haven't tried this yet:

echo "The files were created on `date`" >> someone.txt

as I am having difficulty editing the ftp program file using vi editor - whatever keystroke I press it does something different on the file
 
the command date is enclosed in back quotes. This is on the same key as the tilde (~)

--
-- GhodMode
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top