[Memphis.pm] quotes in program arguments

Hal Phillips HPhillips at harrahs.com
Tue Nov 12 11:41:10 CST 2002


Thanks, but the problem is that I can't modify the incoming message before I
see it.

-----Original Message-----
From: Steve Lane [mailto:sml at zfx.com]
Sent: Tuesday, November 12, 2002 11:20 AM
To: memphis-pm-list at pm.org
Subject: Re: [Memphis.pm] quotes in program arguments


Hal Phillips wrote:
> 
> Hey, does anyone know how to tell perl to interpret quotes in a program
> argument as just part of a string?  More precicely, I need something that
> basically will take the equivalant of echo's $* as a command argument.
> 
> What I neet to do is have a perl program that I can to this with:
> >program.pl -o [2002-11-12 09:00:00]: subject=SOMETEXT,
> message={SEVERITY="ERROR", ACTION="None", MOREKEYS="MOREVALUES", ETC="ETC
> ETC ETC"}
[snip]
> > program.pl -o Sam"I"am
> SamIam
> 
> what I need is Sam"I"am to actually make it through uninterpreted.

this has nothing to do with Perl; it's a shell question.
your shell acts on the double-quotes before they ever reach
perl.  the same would happen if you had any of [*?'><&] (etc)
in your argument.

just single-quote your argument:

$ echo Sam"I"am
SamIam
$ echo 'Sam"I"am'
Sam"I"am

if your argument has single-quotes, you'll have to escape them,
in your preferred way of shell-single-quote-escaping, such as:

$ echo 'Sam"I"a'"'"'m'
Sam"I"a'm

--
Steve Lane <sml at zfx.com>
----------------------------------------------------------------------------
To unsubscribe, please send email to majordomo at pm.org
with 'unsubscribe memphis-pm-list' in the body of the message.
----------------------------------------------------------------------------

----------------------------------------------------------------------------
To unsubscribe, please send email to majordomo at pm.org
with 'unsubscribe memphis-pm-list' in the body of the message.
----------------------------------------------------------------------------




More information about the Memphis-pm mailing list