WORLD'S WORST SOFTWARE
Software by jason, for jason.
Software by jason, for jason.
Home
About
Articles
Resume
Contact
Software
iPlaylist CopierJava Libraries
ItunesUtilitiesScripts
Bash Scripts
File Size File Size Test Free Space Line Counter List Copy MD5 Tool OS X Rotate Logs Rename It SnapshotPHP Scripts
Write Variable To File WWS MailerJavascript Scripts
WWS Background ScalerInteresting People
Admins
Phil GlocknerDesigners
Tonya Browning Catherine Chu Justin Cox Richard Georges Stephen Gray Jonathan Horak Justin Kiehl Andrea Spencer MeatheadDevelopers
Chris Austin Joost van Dongen Noah Figg Rick Hogge John Quarles Wayne Rittiman Joe Rivera Brent Schneeman David Scott Andy Skelton Pavan TumatiFree Space
The free space bash script echoes disk free space for the disk you specify to stdout.
Dependencies
bash, test, df, awk, grep, echo
Download
freespace.sh [740 bytes]
The Script
#!/bin/bash
########################################################################
#
# freespace.sh - disk free space display script
# written by Jason Baker (http://www.worldsworstsoftware.com)
#
########################################################################
#
# UPDATES:
# 2006/10/25
# - updated usage notes
# 2006/10/13
# - initial version
#
########################################################################
if test -z "$1"
then
echo "freespace.sh displays the space free on a drive you specify"
echo
echo "USAGE"
echo " freespace.sh DRIVE"
echo
echo "ARGUMENTS"
echo " DRIVE - the drive to display free space for"
echo
exit
fi
df -h "$1" | awk '{print $4}' | grep -E -o '[0-9]+([\.][0-9]+)?[G|K|M]?'
########################################################################
#
# freespace.sh - disk free space display script
# written by Jason Baker (http://www.worldsworstsoftware.com)
#
########################################################################
#
# UPDATES:
# 2006/10/25
# - updated usage notes
# 2006/10/13
# - initial version
#
########################################################################
if test -z "$1"
then
echo "freespace.sh displays the space free on a drive you specify"
echo
echo "USAGE"
echo " freespace.sh DRIVE"
echo
echo "ARGUMENTS"
echo " DRIVE - the drive to display free space for"
echo
exit
fi
df -h "$1" | awk '{print $4}' | grep -E -o '[0-9]+([\.][0-9]+)?[G|K|M]?'
© 2006, 2007 Jason Baker