Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

sh: -c: line 0: syntax error near unexpected token `('

by ilans11il (Initiate)
on Nov 27, 2013 at 08:54 UTC ( #1064581=perlquestion: print w/ replies, xml ) Need Help??
ilans11il has asked for the wisdom of the Perl Monks concerning the following question:

Hi , Could you please advise , What is wrong with my command:
$RT_DiffFiles= `comm -23 <(sort $RT_64OG_FilesPath) <(sort $RT_64_File +sPath)`;
the error:
sh: -c: line 0: syntax error near unexpected token `(' sh: -c: line 0: `comm -23 <(sort ./TmpData/RT_64OG_Files) <(sort ./Tmp +Data/RT_64_Files)'
the print of the command:
comm -23 <(sort ./TmpData/RT_64OG_Files) <(sort ./TmpData/RT_64_Files)
from linux the command is working with no problem... thanks in advanced

Comment on sh: -c: line 0: syntax error near unexpected token `('
Select or Download Code
Re: sh: -c: line 0: syntax error near unexpected token `('
by derby (Abbot) on Nov 27, 2013 at 11:08 UTC

    Looks like sh on your system is not bash (or any shell that supports the process substitution syntax).

    -derby

    Update: You could always force bash:

    $RT_DiffFiles= `bash -c \"comm -23 <(sort $RT_64OG_FilesPath) <(sort $ +RT_64_FilesPath)\"`;
    but I'd look to see if Text::Diff accomplishes what you're after first.

Re: sh: -c: line 0: syntax error near unexpected token `('
by oiskuu (Friar) on Nov 27, 2013 at 17:48 UTC
    Compare FOO=... to $FOO=.... First one assigns to a variable, the latter will expand variable, =, ... parts, then attempt to execute the result.

    In other words, be mindful of where you put the $.

      RT_DiffFiles=`comm -23 <(sort $RT_64OG_FilesPath) <(sort $RT_64_FilesPath)`;
      echo "$RT_DiffFiles";
    

    Are you trying to rewrite this as perl code?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (21)
As of 2015-07-06 18:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (80 votes), past polls