Ask Dave Taylor: Tech and Business

Tuesday

How do I customize a script from "Wicked Cool Shell Scripts"?

Regarding script #41 (calculating available disk space), out of your book Wicked Cool Shell Scripts, I am unclear how I can have this script calculate the free space on one specific drive, namely /Volumes/Documents HD in my case.

I'd also love to know how I can automatically email the results of this same script, say every 24 hours. If you could kindly point me in the right direction, I'm sure I could figure out the rest!


This is a fairly straightforward script you've asked about, so this will be an easy explanation.

The most important line in the diskspace script is:

df -k | awk -f $tempfile


Let's just run a quick df -k so you can see the output in question...