Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Just another Perl shrine
 
PerlMonks  

Re^4: sh: -c: line 1: syntax error near unexpected token `|'

by Anonymous Monk
on May 10, 2012 at 13:54 UTC ( #969811=note: print w/ replies, xml ) Need Help??


in reply to Re^3: sh: -c: line 1: syntax error near unexpected token `|'
in thread sh: -c: line 1: syntax error near unexpected token `|'

Regarding quotes, the OP might find a module that provides shell escaping useful. Such as String::ShellQuote.

printf is probably more surefire than echo there:

printf "%s" "$cmd" | grep -e '----'

But shelling out is very error-prone (as the OP discovered) and pretty vain when the code can be reproduced in Perl in a few lines.


Comment on Re^4: sh: -c: line 1: syntax error near unexpected token `|'
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://969811]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2013-06-18 23:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How many continents have you visited?









    Results (636 votes), past polls