procmail
[Top] [All Lists]

Re: =| and newlines

2001-08-28 07:53:25
From: robertb(_at_)continuumsi(_dot_)com (Robert Brown)

Apparently, =| embeds any newlines that occur in the command into the
variable.  For example,

:0
FOO=|echo 4 \* 5 | bc

lets FOO have a newline as the last character in it.

I don't arrive at the same conclusion with my empirical test
using 3.15.  What caused you to so conclude?

I put the following in a test harness and ran it through
procmail:

 :0c
 FOO=|echo 4 \* 5 | bc

 :0
 BAR=|expr 4 \* 5

 LOG = "FOO is $FOO and BAR is $BAR too."


I got this in the log:

 FOO is 20 and BAR is 20 too.



The question is: how can I chop/strip/delete/remove/get rid of the newline
before I use it later?

For example,

:0
BAR=|sed -e 's/XXX/'$FOO'/'

later in the script will fail due to the embedded new-line.


I don't want to check now, but my suspicion is that your multiple
quotes are a problem.


(I cannot use `command` (backticks) because I need to check the return
status of the command.)

There are ways around that, but it's ugly and unnecessary anyway,
so we don't need to go there.

Please cc me on any responses since I no longer subscribe to this list.

-- 
Netcom has imploded.  Please now use NOTnetcom.com for mail.
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Ex-Netcommies:  Mail "forwards" for free forwarding service!
NOT affiliated with EarthLink, Inc.'s Netcom brand identity.
_______________________________________________
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>