| Paladin | Woosta: it's looking for a file to run called "grep email@address.com /var/log/maillog" which I'm guessing doesn't exist.. |
| Woosta | ahhh .. so the remote server is taking the third argument as a single argument .. interesting |
| Paladin | Woosta: no.. the local one is.. shh is taking that as 1 arg, which it is, and trying to run it on the remote server.. |
| Woosta | yeah, I wouldn't have thought exec was in charge at that stage :-D |
| Paladin | Woosta: on the command line, does ssh host "grep foo bar" work? |
| Woosta | I thought the 'command' arg to ssh could be a single arg |
| Paladin | Woosta: IIRC, you need ssh host grep foo bar |
| Woosta | IIRC it does |
| action | Woosta tests |
| Woosta | tests |
| Christian_IS | moin |
| Woosta | It does ssh al "grep foobar@example.com /var/log/maillog" ^^ Succeeds |
| jonsmith1982 | `` |
| Woosta | ahh ssh al "grep\ foobar@example.com\ /var/log/maillog" ^^ fails |
| Paladin | Woosta: ya.. it's because of the shell.. try as 3 args in perl |
| Woosta | I need to quotemeta $needle and $haystack .. not the whole ssh command |
| jonsmith1982 | maybe its because @ needs escaping |
| Randal | why do you \ the space between the args/ that's really wrong |
| Woosta | Randal: trying to work out why the original code wasn't working Is working now exec( '/usr/bin/ssh', $_->hostname, join(' ', "grep", quotemeta $needle, quotemeta $haystack) ); ^^ that works quotemeta("grep $needle $haystack") was what I used to have which is the equiv of the backslashed spaces |
| Randal | map quotemeta, @args; |
| Paladin | Woosta: what about exec( '/usr/bin/ssh', $_->hostname,"grep", quotemeta $needle, quotemeta $haystack ); |
| Woosta | yeah, my code sucks right now, but I wanted to make sure it worked Paladin .. I'll check |
| action | amnesiac maps Paladin and Randal |
| amnesiac | maps Paladin and Randal |
| Randal | exec 'ssh', $_->hostname, map quotemeta, @args; |
| Woosta | yup, pal, that works WHich means Randal's will also |
| Randal | it's too bad ssh doesn't treat its args like sh sh -c 'command $1 $2' "first arg" "second arg" |
| Woosta | yeah :-D |