Discussion:
Scripting problem
Cameron Simpson
2017-10-10 06:11:14 UTC
Permalink
/usr/local/bin/mutt -s $SUBJECT -i $MESSAGE -a $FILENAME --
Your variable substitutions are not quoted, as mentioned. That is critical. The
shell is a tool for assembling command string arrays, and quoting is used to
demark single strings.

[...]
This proves you have a quoting problem. Enclose the parameters
When the variables are being evaluated by the shell, the quotes
during assignment are removed, and you you get is
The unterminated ' is handled more or less gracefully, but it
probably interferes with mutt's address detection. You can
now easily recognize the problem.
No, mutt noever considers it for addresses, because it is the subject string.
There's no "more or less gracefully", it is just a string.

The mutt command is invoked as an array of strings, thus (one per line):

/usr/local/bin/mutt
-s
Today's db backup
-i
path/to/message.txt
-a
/whatever/filename/there.is
--
***@tx.rr.com

There is no subsequent parsing or weird interpretation.
I'm running FreeBSD 10.3-RELEASE and the script is written in bash.
Just say "/bin/sh". It may be implemented by bash on your system, but it is
generally the Bourne shell. Nothing you're doing requires bash itself, but all
UNIX systems have /bin/sh.
Do you have any reasons not to stick to default sh? Do you use
any features specific to bash?
Ah, I see this has also been maddresses.

Cheers,
Cameron Simpson <***@cskk.id.au> (formerly ***@zip.com.au)

Loading...