512vincent / pdsh

Automatically exported from code.google.com/p/pdsh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Document running commands inside a shell with exec module

GoogleCodeExporter opened this issue · comments

Hi,

Is there any trick to make work next sentence ?

pdsh -Rexec -w ^hosts.txt "command1 | command2"

Can we use pipe inside the command with exec module, like we do in ssh module ?

I tried some variants (escapping "|", ...), but I didn't get the correct 
formula to do it works

Thank you!

Original issue reported on code.google.com by javibarr...@gmail.com on 14 Sep 2011 at 1:47

The exec modules runs exec() and not a shell, so pipe won't work directly in the
command line as above. However, you can get all the power of the shell by just 
invoking your command under a shell, e.g.:

 pdsh -Rexec -w ^hosts.txt bash -c "cmd1 | cmd2"

If that doesn't work for some reason, just update this bug.

Original comment by mark.gro...@gmail.com on 14 Sep 2011 at 1:53

  • Changed state: Accepted
  • Added labels: Type-Other
  • Removed labels: Type-Defect
Ok!, It did the work, I didn't remember I was used that trick in find exec 
command before!

I would add an example of this in manpage, there are other people that got 
confused by this issue [1]

Thank you again!

[1] http://code.google.com/p/ssssh/wiki/Details

Original comment by javibarr...@gmail.com on 14 Sep 2011 at 2:13

Thanks, that is a good suggestion!
Changing this issue to a documentation enhancement request

Original comment by mark.gro...@gmail.com on 14 Sep 2011 at 5:03

  • Changed title: Document running commands inside a shell with exec module
  • Added labels: Component-Docs, Type-Enhancement
  • Removed labels: Type-Other