dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | Submodules | README

hooman (382B) [raw]


      1 #!/bin/sh
      2 # hooman -- print fields in human-readable sizes
      3 die() {
      4     echo "$1" 2>&1
      5     exit 1
      6 }
      7 
      8 usage() {
      9     die "usage: hooman [-h N] FIELD [FIELD2 FIELD3 ...]"
     10 }
     11 
     12 [ -z "$1" ] && usage
     13 
     14 case "$1" in
     15     -h)
     16         [ -z "$2" ] && usage
     17         header="--header=$2"
     18         shift 2
     19         ;;
     20 esac
     21 
     22 numfmt $header --field="$*" --to=iec-i --suffix=B --padding=7 --round=nearest