On Monday, January 5, 2015 1:33:09 PM UTC-6, Spriya wrote:
*%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`)* > [...] > 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 `('* > > It looks like you have multiple wierdnesses going on there. In the first place, you are nesting a backtick-quoted command execution inside a %x{ ... } block. That will run the inner command, then (on success) run its output as a command. I don't suppose that's what you want. In the second place, you have a quoting problem. Garet is onto something when he observes that the error is flagging a construct recognized by bash but not by the traditional Bourne shell. His suggestion is probably right, except that he neglects to mention that the whole body of the command needs to be quoted as a single argument following -c. In the third place, your command has odd redirections in it: you redirect the diff output to a file, but you also pipe it to sed. There's only one standard output; you cannot redirect it to two different termini. In the fourth place, you are both piping input into sed, and giving it a file name to process, and moreover, you are specifying in-place editing (-i). This combination should edit the named file, ignoring standard input and producing nothing on standard output. That's ok in itself, but it won't give you anything for your fact value. Supposing that it is important to record the results of the command in a file, as the command seems intended to do, it looks like you want something like this: Facter.add('unknownjava') do setcode do %x("/bin/bash -c '/usr/bin/diff <(/bin/sort /home/weblogic/javafoundmodified.txt) <(/bin/sort /home/weblogic/authorizedjava.txt) | /bin/sed \"s/^.//\" /home/weblogic/unknownjava.txt | /usr/bin/tee /home/weblogic/unknownjava.txt'") end end John -- 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 puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/b34a29ab-9026-4712-aaaa-c5f1c626d125%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.