Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Problems? Is your data what you think it is?
 
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 (Pilgrim) 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: (9)
As of 2014-04-21 12:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (494 votes), past polls