Gary00/OSXey — pull request #8 by jasonkliu (2014-03-23 16:25:52+00:00)
Title: (Features) Display Total Hard Drive Space on Disk (currently shows only a percentage)

I figured out how to do Display Total Hard Drive Space on Disk (currently shows only a percentage). The current command is `df | head -2 | tail -1 | awk '{print $5}'`.
Let's use `df -Hl` (H as in human, and l as in lemon). H stands for human format in base 10, which is the default if you click on Macintosh HD and Get Info. l stands for local storage only, which gets rid of external volumes. This is optional, assuming we're primarily talking about the local disk. Appending the `head -2 | tail -1` command leaves me with this:
> /dev/disk0s2 319G 245G 74G 77% 59889139 18043763 77% /

Using the final `awk` command, we get
$ df -Hl | head -2 | tail -1 | awk '{print $4}'
74G
$ df -Hl | head -2 | tail -1 | awk '{print $3}'
245G
$ df -Hl | head -2 | tail -1 | awk '{print $2}'
319G

So a proposed method of the commit should be:
> disk=`df -Hl | head -2 | tail -1`
> dpercent=`echo $disk | awk '{print $5}'`
> dfree=`echo $disk | awk '{print $4}'`
> dused=`echo $disk | awk '{print $3}'`
> dcapacity=`echo $disk | awk '{print $2}'`

> echo "dpercent $dpercent"
> echo "dfree $dfree"
> echo "dused $dused"
> echo "dcapacity $dcapacity"
> echo "final: $dused / $dcapacity"

which gives me:

dpercent 77%
dfree 74G
dused 245G
dcapacity 319G
final: 245G / 319G