#!/usr/bin/perl5.003 # A perl(1) program to df(1) and extract the pertinent directories, sum the # usages, convert the result to megabytes, and append the 'Mb' to it. Try it # out just by running it. # # Future versions of pibu(1) will use scripts that will be invoked with # parameters taken from the config file, so that we won't need a different # version of this program for each fileset. open(PIPE_HANDLE, "df |") || die; $spaceused = 0; while () { ($dev,$total,$used,$avail,$cap,$mounted) = split(/\s+/, $_); if ($mounted eq '/' || $mounted eq '/usr') { $spaceused += $used; } } close PIPE_HANDLE; printf "%2d Mb\n", $spaceused / 1024;