15 ms·
Commands can have a maximum number of arguments. Try globbing on a directory with millions of files.
by chrsig 2y ago
Commands can have a maximum number of arguments. Try globbing on a directory with millions of files.
- anthk 2y agoSane people will just use find and/or xargs.
- nmz 2y agoWeird thing to call sane when its the shell that is insane, or more likely an instrument of torture.
- arp242 2y agoUsually the pattern is "for f in [glob]", which doesn't have that issue. Running "ls" on a directory is little more than "for f in *; echo $f" so there's little advantage to using "ls". Also: "find -exec {} \+" will take ARG_MAX into account, and may be much faster depending on what you're doing.