On 5 January 2015 at 19:33, Spriya <[email protected]> wrote: > Hi, > > I am trying to run linux command through puppet. when i run the same command > in the command line it is working fine. But when i placed it in the puppet > it is throwing me an error. > > Here is the code: > > Facter.add('unknownjava') do > setcode do > %x(`/usr/bin/diff <(/bin/sort /home/weblogic/javafoundmodified.txt) > <(/bin/sort /home/weblogic/authorizedjava.txt) > > /home/weblogic/unknownjava.txt | /bin/sed -i 's/^.//' > /home/weblogic/unknownjava.txt`) > end > end > > > Here is the error: > sh: command substitution: line 0: syntax error near unexpected token `(' > sh: command substitution: line 0: `/usr/bin/diff <("/bin/sort > /home/weblogic/javafoundmodified.txt") <("/bin/sort > /home/weblogic/authorizedjava.txt") > /home/weblogic/unknownjava.txt | > /bin/sed -i 's/^.//' /home/weblogic/unknownjava.txt' > sh: command substitution: line 0: syntax error near unexpected token `(' >
I'm guessing here a little but I think this is because the command is executing under sh, and when you run in manually it's executing under bash. So try something like: (`bash -c /usr/bin/diff .... Gareth > > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-users/8b32a0d5-f06a-4598-9f72-b5a3aca4a610%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- Gareth Rushgrove @garethr devopsweekly.com morethanseven.net garethrushgrove.com -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAFi_6y%2BznKWE-qB07Zp_GX%2BvdzM71TM9eDmd29Dg9NmA_0h3Pw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
