6 ms·
I don't understand the point of the script, it's nothing more than: du -h --max-depth=1 "$@" | sort -hr
by mshook 2y ago
I don't understand the point of the script, it's nothing more than:
du -h --max-depth=1 "$@" | sort -hr
- out-of-ideas 2y ago`-h` is not available in all `sort` implementations
- BlackLotus89 2y agoEven the busybox port has it. The only sort implementation I know of that doesn't have -h is toybox (I guess older busybox implementations are missing it as well), but I'm using -h for well over a decade and seldom had it missing
- out-of-ideas 2y agoi was actually curious when busybox's sort added it; but didnt search too hard. was certainly easy to see gnu get it in 2009 i think (but even then if the dude setup there bashrc long ago and that func/alias works, likely no reason to change it immediatly) i can say an `BusyBox v1.35.0 (2022-08-01 15:14:44 UTC)` did not have -h; so it having it now is kind of a shock to me (looks like busybox v1.36.1 has it - at least from 2023-06-22) - good too! always frustrating when a dev tries using gnu-args and it blows up and i gotta explain the diff between mac-shell-cmds, gnu, and busybox
- dotancohen 2y agoThe point is that it is faster.
- zamadatix 2y agoA bash script for postprocessing the sorting is certainly slower than just having sort do it correctly in the first place.
- INTPenis 2y agoI found this online a long time ago, and it's been with me across BSD, Macintosh and Linux. So I can't say why it is that way, and I didn't know about sort -h before today.