Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Nice. I just had to check to see if xargs has a similar feature. It doesn't, though the --no-run-if-empty and --verbose options are both handy. I believe I've used xargs with "echo <commandlist>" to proof output before committing it.

You can simply re-run that piped to bash (or your shell of choice) to execute commands if you wish (say, if parallel isn't available).

E.g.,

     echo foo bar baz | xargs -n1 -t echo ls | bash
... will execute 'ls foo; ls bar; ls baz', while showing the expanded command.


Yes, you can use echo, but that won't work if the command is something like "ls DIR | wc -l".


Depending on how you want to do your counts or piping, you could run that after the xargs / parallel execution, which would be much more efficient (fewer processes and execs) anyhow.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: