> From: Daniel P. Berrangé <[email protected]> > Sent: Friday, November 21, 2025 12:09 > Subject: Re: [PATCH 1/1] scripts: Changed potential O(n) file size > calculation to > O(1)
> > ls_line=$(ls -Hdog "$1" 2>/dev/null) || return > > > > > + printf %s\\n "$ls_line" | cut -d\ -f3 > > > + unset ls_line > > This parsing of 'ls' output could be simplified by using the 'stat' command > with a format string to request only the file size. > > stat --format=%s "$1" The use of `wc' results from the fact that `stat' is not available on all platforms, iMacOS in particular, to my knowledge.
