procmail
[Top] [All Lists]

echo expands * in string to list of file names

2002-01-15 11:39:03
I have the following procmail recipe, and it's not behaving as I want when asteriks (*) are in the Subject line.


SENDER  = `formail -rtzx To:`
SUBJECT = `formail -zxSubject:`
TODAY   = `date "+%Y-%m-%d %T"`

:0 hwic: log.lock
|  echo -e $TODAY "\t" $SENDER "\t" $SUBJECT >> log-addmsg

which produces this for 2 recent messages.


2002-01-15 03:23:14      james(_at_)aol(_dot_)com        New newsletter

2002-01-15 03:26:14 sally(_at_)cs(_dot_)com backup backup.tar backup.tar.0 backup.tar.1.gz backup.tar.2.gz backup.tar.3.gz bounces cleanup_script log-addmsg log-addmsg.0 log-addmsg.1.gz log-addmsg.2.gz log-addmsg.3.gz log-addmsg.4.gz log-addmsg.5.gz log-forgery log-noarchive new-procmailrc procmailog procmailog.0 procmailog.1.gz procmailog.2.gz procmailog.3.gz Updated Schedule backup



The Subject line of the second message was *** Updated Schedule ***, and the asteriks got expanded to grab all the file names in the directory.

I have tried echo -E and various combinations of single and double quoting items without success. There are not a lot of options with the echo command, and none of them will turn off this expansion.

I am using Bash 2.05a on a Debian Linux machine.

I suppose I could pre-process the Subject line, and append a backslash (\) character before any asteriks. THat does solve the problem.

Are there any other shell commands, other than echo, that work with variables, that would work in this situation ?

Are there any fancy quoting syntaxs that can be applied to keep echo from expanding the *.

Do I have to worry about other characters than *, and unexpected things that might happen when they appear in the Subject line. I am not expecting control characters to ever get into a Subject line.

Thanks for any clues.

mark





_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>