Paul W. Roach III on 19 Nov 2007 22:48:04 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Perl backticks/system question

  • From: "Paul W. Roach III" <paul@isaroach.com>
  • To: "Philadelphia Linux User's Group Discussion List" <plug@lists.phillylinux.org>
  • Subject: Re: [PLUG] Perl backticks/system question
  • Date: Mon, 19 Nov 2007 15:05:50 -0500
  • Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:references:x-google-sender-auth; bh=0Hz0PQgxdNnPf1oUtYY4nxk9J56ecCJV4ush68DNxL8=; b=WCJROv4CKm/0DYRX2IOgiCwhwbXEAHWNeGT3daSYdtY2wYkAR0NAf0rMdTODOi3pavbwTu/B+quoGnZw/qclPCG//8TZL2In6G7ORLm4drn8n3EZ6hsNZncnvEzkNkQE2K+aRnUFm00FHncs/xy8Gb4SMvWEVpAC7PnFVIk6ttA=
  • Reply-to: Philadelphia Linux User's Group Discussion List <plug@lists.phillylinux.org>
  • Sender: plug-bounces@lists.phillylinux.org

Often this can take many escapes to make it work.  I've seen the need to do things like:
 
 
It sounds weak, but try adding \'s until you stop getting the error :)
 
It's really wacky, but I've seen perl scripts calling ssh via the shell on pipes and running remote commands -- you have to escape things like 6 times -- each intermediate shell strips off half of the \ chars.
 
-P

On Nov 19, 2007 2:31 PM, gabriel rosenkoetter <gr@eclipsed.net> wrote:
At 2007-11-19 11:08 -0500, lists@linuxnotes.net < lists@linuxnotes.net> wrote:
> I have a bash script that I need to run from within a Perl script and
> capture the output.  My script works fine until it hits a parentheses in
> an argument and then I get:
>
>     sh: -c: line 0: syntax error near unexpected token `('

It'd help to see the code, but I think that you need to escape the
parens.

(Remember characters that are special for Perl will be processed and
eaten within double-quotes and backticks when not escaped, but never
touched within single-quotes.)

--
gabriel rosenkoetter
gr@eclipsed.net

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug


___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug