Michael Greb on 19 Nov 2007 16:30:45 -0000 |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 lists@linuxnotes.net wrote: > Hi all, > > 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 `(' > > I understand that if there are arguments in backticks the command is sent > to the shell for interpretation, but if I run the command outside of my > Perl script it works fine so I am not sure where I am getting the error > from. I have used quotemeta() to escape all the special characters. Can you provide some samples? I haven't used quotemeta before but according to it's docs it doesn't look like what you want: [michael@orion(~)] perldoc -f quotemeta quotemeta EXPR quotemeta Returns the value of EXPR with all non-"word" characters backslashed. (That is, all characters not matching "/[A-Za-z_0-9]/" will be preceded by a backslash in the returned string, regardless of any locale settings.) This is the internal function implementing the "\Q" escape in double-quoted strings. If EXPR is omitted, uses $_. - -- Michael Greb Linode.com, LLC -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHQboq0Qbp4bPZvesRAl4aAJ4wXhIDZm8o2KLhWmgwSBn77quxCwCfYnt1 j1JfixcBS1fwBKkuIPTbeks= =nogh -----END PGP SIGNATURE----- ___________________________________________________________________________ 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
|
|