procmail
[Top] [All Lists]

Re: Extracting Filename

2000-01-05 16:22:29
SoloCDM <deedsmis(_at_)ris(_dot_)net> writes:

What would the syntax be to properly append information to the end of the LOG
variable (including newlines, spaces, special characters, etc.)?

First, read <http://www.iki.fi/era/procmail/mini-faq.html>, and in
particular read the section on creating and using a test script
(Troubleshooting tips). Of course, you have already read the man pages.

Appending to the log is simply concatenating a string value. This is
done by assigning the new string to the variable LOG, and all of the
standard rules apply to that new string. To insert a newline, simply put
a newline into the quoted string.

Spaces within quoted string are left alone. Spaces don't exist outside
of quoted strings when making an assignment in procmail.

The treatment of special characters depends on they type of quoting
(strong or weak) you are using. If those terms (or the difference
between 'a\$$b' and "a\$$b") is not clear, you have to learn a bit about
shell quoting before tackling this or any moderately complex procmail
recipes.

Appending multiple lines to the log can be done literally, as:

LOG="This is on one line
and this is on another"

or it can be done with a variable:

NL="
"
LOG="This is on one line$NL and this is on another$NL"

NL is set to <doublequote><return>doublequote>

Note that I have a space after $NL in the LOG assignment. If I wrote
$NLand, procmail would look for a variable named NLand, which it
probably wouldn't find. To overcome this, I could write ${NL}and, and
obviate the need for the space. Also note that the first example will
end without a newline, and whatever is next appended to log will begin
directly after the word 'another', on the same line. Placing another
carriage return before the final doublequote will cure this.

Also, please drop the P.'S.

1. There is no apostrophe needed, or warranted. Apostrophes don't mean
"Look out everyone, an S is on the way!"

2. The periods aren't needed. Not two, anyway. Only one word is being
shortened.

3. The abbreviation is ps. It stands for the Latin word postscriptorum,
which means something written after. Way back when our ancestors used
pen and paper, it was difficult to go back into a text and make changes.
If they had something important to add, they wrote it afterwards, and
labeled it as such. It is a meaningless affectation here.

-- 
Rik Kabel       Click *here* to lower control rods       
rik(_at_)netcom(_dot_)com

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