procmail
[Top] [All Lists]

Re: Problems eleminationg \ in a string

2010-12-20 14:31:25
On Mon, Dec 20, 2010 at 08:41:52PM +0100, Michelle Konzack wrote:
     TMPVAR7a=`echo "${TMPVAR7a}" |tr -d '\\' ; :`
[...]
tr: warning: an unescaped backslash at end of string is not portable
procmail: [16425] Mon Dec 20 20:32:28 2010
procmail: Assigning "TMPVAR7a=Graphics and LCD"
[...]
Question:   HOW TO ELIMINATE the \ in a string?

From a command line, I get this:
$ echo "foo\\bar\\baz" | tr -d '\'
tr: warning: an unescaped backslash at end of string is not portable
foobarbaz
$ echo "foo\\bar\\baz" | tr -d '\\'
foobarbaz

My guess is that procmail is eating one level of the backslashing, so it's passed to tr the way it is in my first example, generating the warning.

If this is correct, you could fix it by changing the line to:
# procmail removes one level of \-escaping, so pass \\\\ to get \\
TMPVAR7a=`echo "${TMPVAR7a}" |tr -d '\\\\' ; :`
Ed

Attachment: signature.txt
Description: Digital signature

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail
<Prev in Thread] Current Thread [Next in Thread>