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!

simple mail scripting 1

Status
Not open for further replies.

Nostradamus

Technical User
May 3, 2000
419
SE
I'm worthless when it comes to scripting.
I have a Linux system where I want to do the following.
I've encrypted some files using.

gpg --encrypt-files --armor -r [reciever] /my/files/*.csv

This makes a *.csv.asc file for each encrypted file. In my case over a hundred files.

I then want to email these files with the content of the file as the emails text-message.
Something like this...

mail -s [subject] user@mydomain.com < /my/files/file1-100.csv.asc

I want each .asc message to be sent as one email.
So a hundred seperate emails. How can I automate this?
Can I take the output of ls or something and put it after the < sign?
Hope you understand what I mean. If not... ask and I'll try to explain it more clearly.

thanks in advance.

/Sören
 
for f in /my/files/*.csv.asc; do
mail -s [subject] user@mydomain.com < $f
done

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
well, what can I say.
It was right on target. *star*

/Sören
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top