Skip to main content
14 events
when toggle format what by license comment
S Aug 27 at 19:52 history suggested Fonic CC BY-SA 4.0
Removed unreachable units, added syntax highlighting, added hint for highest possible value
Aug 27 at 7:07 review Suggested edits
S Aug 27 at 19:52
Aug 9, 2023 at 13:05 comment added Kevin Simper Something on Mac make it not work unfortunate, it makes it a order of magnitude lower. $ bytesToHumanReadable 123456789 117.73 KiB
Jun 19, 2020 at 18:57 comment added Fonic @G-ManSays'ReinstateMonica': This specific answer is about Bash, and Bash spawns subshells when using $(), drastically lowering performance. Not an issue if you just call the function once, but if you use it in a loop it's quite noticable. Double quotes are used for all quoting in Bash code by default (unless you don't want variable expansion), so this is just a matter of good coding style, nothing more. '1TB of storage' is a text quote in a comment, and in English you wouldn't use double quotes for that.
Jun 18, 2020 at 21:55 comment added G-Man Says 'Reinstate Monica' P.P.S. Some shells do some optimization. $(command) doesn’t necessarily spawn a subshell if command is a built-in.
Jun 18, 2020 at 21:46 comment added G-Man Says 'Reinstate Monica' @Maxxim:  We can see exactly what you changed.  The edit comment should be more of a summary (e.g., “Refactored code; added upper limit to while-loop.”), with perhaps some justification (e.g., “avoid subshell by using 'printf -v' ”).  I try to keep my edit comments to a maximum of around 150 characters (yours is 275). … … … … … … … … … … … … … … P.S. Why bother “use double quotes for all quoting”?  And why do you say that you’re using double quotes for all quoting, but then change "1TB of storage" to '1TB of storage'?
S Jun 18, 2020 at 18:03 history suggested Fonic CC BY-SA 4.0
Make function variables local, expand array S for better readability, use double quotes for all quoting, rename variable b to i (integral/integer), avoid subshell by using 'printf -v', replace 'let s++' with arithmetic expression, add upper limit for variable s to while-loop
Jun 18, 2020 at 8:14 review Suggested edits
S Jun 18, 2020 at 18:03
May 29, 2020 at 23:00 history edited slm CC BY-SA 4.0
edited body
S Jun 14, 2018 at 11:02 history suggested Gilles LAMIRAL CC BY-SA 4.0
There was two big mistakes in the order: Peta was after Exa and Zetta was after Yotta!
Jun 14, 2018 at 9:56 review Suggested edits
S Jun 14, 2018 at 11:02
May 17, 2017 at 23:01 comment added Camilo Martin @WinEunuuchs2Unix thanks, I'm glad it was helpful to you :)
Apr 22, 2017 at 15:46 comment added WinEunuuchs2Unix This is the best answer for my bash needs. Unfortunately it's posted 1/2 a decade after OP date meaning it'll take a while to move up voting list.
Feb 2, 2016 at 7:55 history answered Camilo Martin CC BY-SA 3.0