Skip to main content
12 events
when toggle format what by license comment
Apr 27, 2016 at 18:17 history edited Anthon
edited tags
Mar 12, 2015 at 8:53 comment added mikeserv t=$(((g=(m=(k=1024*(b=1))*k)*k)*k)), you can then do the check like for s in t g m k b; do [ "$((n>=$s))" -ne 0 ] && break; done || ! echo 0 bytes\! && echo "$((n/$s))${s#b}b"
Mar 12, 2015 at 8:28 answer added Thomas timeline score: 1
Mar 12, 2015 at 8:17 history edited Thomas CC BY-SA 3.0
added missing closing ' ) ' @gigabytes
Mar 12, 2015 at 4:27 comment added dhag Other bug fixes include replacing mb with kb in the kilobytes case, and thinking about what happens when the input is exactly equal to one of the constants (you can get rid of about half of the comparisons), or if it is lower than $kb.
Mar 12, 2015 at 0:01 history edited jasonwryan CC BY-SA 3.0
Title, tags, formatting
Mar 11, 2015 at 23:44 answer added wie5Ooma timeline score: 2
Mar 11, 2015 at 22:31 comment added ott-- Finally for every elif, eliminate the && because it's already true.
Mar 11, 2015 at 22:19 comment added Costas Additionally change echo "$(( number > gb )) to echo "$(( number / gb )) == symbol > by /. More would like to test numfmt --to=iec command.
Mar 11, 2015 at 22:14 comment added Cyrus Use shellcheck.net and add ) in line 10.
Mar 11, 2015 at 22:11 review First posts
Mar 11, 2015 at 22:20
Mar 11, 2015 at 22:07 history asked Thomas CC BY-SA 3.0