Mailing file from UNIX/bash


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Mailing file from UNIX/bash
# 1  
Old 06-13-2014
Mailing file from UNIX/bash

I have a file that I want to mail out. However, I cannot get the date to print on it.
I've tried the following:

Code:
/usr/bin/mail -s "Lists on `date`" myname@company.com</tmp/list
/usr/bin/mail -s "Lists on $(date)" myname@compancy.com</tmp/list
$subj="Lists on $(date)" 
/usr/bin/mail -s "$subj"  myname@company.com</tmp/list
/usr/bin/mail -s  $subj="Lists on $(date)"

I'm just not getting it. The list is mailed, but the date never appears. The subject title does appear; I've tried single quotes as well
# 2  
Old 06-13-2014
What's your MTA? Not all of them support -s. Usually you put a subject in an email by having the line "Subject: ..." in the headers.
# 3  
Old 06-13-2014
Use mailx instead:
Code:
/usr/bin/mailx -s "Lists on $(date)" myname@compancy.com</tmp/list

This User Gave Thanks to Yoda For This Post:
# 4  
Old 06-13-2014
In addition to what Corona688 and Yoda have already said, you might have avoided the issue if you would have used:
Code:
subj="Lists on $(date)"

instead of:
Code:
$subj="Lists on $(date)"

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need syntax for mailing in UNIX by using html file as body and along with attachment

Hi All, I need a syntax for mailing in unix by using html code file output as body and along with attachment (without using mutt command) HTML code file : html1.txt Attachment : attach1.txt I was using the below codes but they are not working. ( cat html1.txt ; uuencode attach1.txt... (4 Replies)
Discussion started by: Rokkesh
4 Replies

2. OS X (Apple)

Where should I install an alias file under UNIX bash ?

I have a file named 'aliases' which contains a list of aliases like: alias loc='locate' alias h='history' alias .='pwd' alias ..='cd ..' alias cd..='cd .. ; pwd' .............................. Where should I put this file (alias) so when Terminal launches .bash and thus a shell at... (1 Reply)
Discussion started by: shub22
1 Replies

3. Shell Programming and Scripting

Mailing a file at a particular time interval

Folks, I need to send a .log file to my email for every one hour from a server that too only in a particular time period. Is awk mandate here? or can we do it in shell scripting only? Please help me in sorting this out. Cheers, Arun (3 Replies)
Discussion started by: ArunJanga
3 Replies

4. UNIX for Dummies Questions & Answers

Mailing in unix

is there any option to mail the value from top command directly to the user.. i want the value of cpu usage from six different servers to be send in a single mail.. thanks, Arun Manas:b: (3 Replies)
Discussion started by: arunmanas
3 Replies

5. Shell Programming and Scripting

mailing problem in unix

I have a mailing problem in UNIX.... MAILT="$1" MAILTO=`echo $MAILT | tr ';' ','` CONTENT="/var/www/html/notifier/mailnotify_ccdb.html" SUBJECT="$2" CC="man@abc.com" BCC="ant@abc.com" ( echo "To : ${MAILTO}" echo "Cc : ${CC}" echo "Subject: $SUBJECT" echo "MIME-Version: 1.0" ... (3 Replies)
Discussion started by: rdhanek
3 Replies

6. UNIX for Advanced & Expert Users

How would I create a NULL terminated file in Unix under Bash?

I am testing some file routines against potential "nasty name" Unix files, such as those with a CR, LF, in the middle or NULL terminated, utf multi-byte character. So, under Bash, I want some way of: mv "name" "name\0" with the \0 a real NULL. Against all my efforts, I have not been... (2 Replies)
Discussion started by: drewk
2 Replies

7. UNIX for Advanced & Expert Users

problem mailing HTML code in cron file.

Hi All, I have written a script which sends mail using “sendmail” command and mail contains HTML code. When I run scripts on terminal it is working properly, but when I try to run this script through a crontab file it sends blank mail with proper subject. crontab file detail : 00 05... (1 Reply)
Discussion started by: abhishek.mind
1 Replies

8. UNIX for Advanced & Expert Users

Processing extended ascii character file names in UNIX (BASH scipts)

Hi, I have a accentuated letter (ö) in a script for an Installer. It's a file name. This is not working and I'm told to try using the octal value for the extended ascii character. Does anyone no how to do this? If I had the word "filförval", can I just put in the value between the letters, like... (9 Replies)
Discussion started by: peli
9 Replies

9. UNIX for Dummies Questions & Answers

mailing from unix -> exchange

Hello, I want to mail from Unix 4.3 (on an RS/6000) to my Microsoft exchange server (5.5). When I trie : mail -v erikr@domain.nl < /directory/file I get the following error: ^Cserverone:/etc >WARNING: The local host name (serverone) does not have a domain; fix$jnconfig ... (7 Replies)
Discussion started by: Erik Rooijmans
7 Replies

10. UNIX for Advanced & Expert Users

Mailing thru UNIX shell script

Hi, I need to send an email from an UNIX shell script along with an attachment. I am working on an HP-UX 11.00 system. The only mailing program which provides adding an attachment to a mail is "pine". However pine is not installed on my system and I cannot install it too due to the server being a... (2 Replies)
Discussion started by: navin
2 Replies
Login or Register to Ask a Question