Re: Problems eleminationg \ in a string

Ed Blackman <[email protected]>
Newsgroups gmane.mail.procmail
Message-ID <[email protected]>
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

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
[email protected]
http://mailman.rwth-aachen.de/mailman/listinfo/procmail
signature.txt (application/pgp-signature, 190 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iD8DBQFND70D3nrUNJhVPs4RAoW5AJ0dgYCBMxPX4HjqMMtMwMjQCpXyuACfdhX3
yXCxfgnP7rxE0AfDD48k9U4=
=UsGt
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.