15 ms·
awk '{ print your_command }' | bash Never can remember all the -I stuff around xargs
by rcpt 5y ago
awk '{ print your_command }' | bash
Never can remember all the -I stuff around xargs
- chubot 5y agoThis is like the sed|bash anti-pattern mentioned in the original post, and quoted in the appendix on shell injection. I wouldn't say "never use it", but I would hesitate to ever put it in a script, vs. doing a one-off at the command line.
- rcpt 5y agoYou don't pipe to bash on the first run. Use awk/sed without piping to workshop your commands. Once you've got them right send over to bash. This is far superior to futzing with xargs interactive or whatever dry run feature they have.
- chubot 5y agoSee the string injection comment: http://www.oilshell.org/blog/2021/08/xargs.html#more-comments http://www.oilshell.org/blog/2021/08/xargs.html#more-comment... https://lobste.rs/s/wlqveb/xargs_considered_harmful#c_kwsxtc https://lobste.rs/s/wlqveb/xargs_considered_harmful#c_kwsxtc