4 ms·
in zsh you can just write: for x (*.sh); echo "before $x after" or for x in *.sh; echo "before $x after" or for x (*.sh) { echo -n "before "; echo
by raggi 2mo ago
in zsh you can just write:
for x (*.sh); echo "before $x after"
or
for x in *.sh; echo "before $x after"
or
for x (*.sh) { echo -n "before "; echo -n $x; echo " after" }
- PunchyHamster 2mo agomissed the point. reason to use xargs or parallel are generally two: list of arguments is too long, or list of arguments that is kept in memory would take too much for example for a in `find / ` ; do echo $a ; done will take A LOT of memory, while using find's -exec, xargs, or parallel will not
- foobarqux 2mo agoBut bashenumerate doesn't do that? The parent is saying you should zsh shortloops instead of bashenumerate not zsh shortloops instead of xargs.
- unsnap_biceps 2mo agoI looked into the source and the underlaying source uses a glob and suffers from the issue you brought up. https://github.com/wallach-game/bashumerate/blob/master/lib/enumerators/files.sh https://github.com/wallach-game/bashumerate/blob/master/lib/...
- raggi 2mo agoIn my experience once you get to the point where you run out of space in the glob you’re often suffering with poor performance from spawning children as well and it’s time to move to a more formal program even if it’s a script, writing out work plans and completions to list files to avoid wasted time. It’s often a great guardrail to remind you to do this