It took me a while, but I finally figured out how to print a number from a bash script properly formatted with commas as thousand’s separators. For those like me who weren’t in the know, the magical incantation is:
printf "%'d" 123456
That will format 123456 as 123,456. Much easier to read when you’re dealing with large numbers such as the sizes of files in gigabytes.
So now if I could only find the Unix command that took a number of bytes and turned it into an approximate value with GB or MB suffixes.