Why 'man mail' didn't help me much

Adam Davis a.l.d at att.net
Mon Apr 8 22:03:13 CDT 2002


A week (?) ago I asked for help.  I was attempting to send mail w/
attachments from a bash script to be run by crond, in order to email a
user .tar.gz files files so that, in the event of a crash, we had copies
of the files other than the local backups.  I got a lot of 'man mail' as
response.  The problem with 'mail' is that it didn't deal directly with
attachments, but I got around that.  The really big problem with 'mail'
is that it wanted me to Ctrl-D my way out, which I was having problems
doing from a script that wasn't supposed to be interactive.

I simplified the more difficult part and borrowed a pre-written script
that would take file-names as arguments and automatically run all the
requested encoding.  (You can find it at
http://home.clara.net/dwotton/unix/mail_files.txt)

However, I was still getting trapped in a mailer that wanted me to
Ctrl-D out.

I learned a neat little trick this weekend - echo $'x04'  ... It took
awhile to find a file that specifically mentioned that you can, in fact,
force in such things as Ctrl-D (the ASCII EOT character, 0x04
hexadecimal) without being around to type Ctrl-D.  Almost every file I
came across had ^D, and then said you had to type that in yourself...
That's not true.

It is incredibly easy to do, once you figure out how.  Not mentioned
anywhere, though, that I could find - emailing attachments without
interaction.  It's certainly not mentioned in 'man mail'...

~ald




More information about the Kclug mailing list