Re: question for script whizzes

From: Miller, Dave (Dave.Miller@BHS.ORG)
Date: Mon Aug 12 2002 - 16:49:47 EDT


great, thanks!!

-----Original Message-----
From: Robert Miller [mailto:rmiller@SMUD.ORG]
Sent: Monday, August 12, 2002 4:43 PM
To: aix-l@Princeton.EDU
Subject: Re: question for script whizzes

total=0
for foo in `df -Ik | grep ^/ | awk {'print $4'}` # Note that those are
graves/backticks...
do # and that the ^/ gives
you only the local filesystems
  total=`expr $total \+ $foo` # if you wanted ALL
filesystems you'd want to run that thru
done # head/tail to chop off
the header line
echo "TOTAL DISK USAGE: $total\n"

Love using the "for foo in..." construct, very handy. Hope that helps.

--rm

-----Original Message-----
From: IBM AIX Discussion List [mailto:aix-l@Princeton.EDU]On Behalf Of
Miller, Dave
Sent: Monday, August 12, 2002 1:26 PM
To: aix-l@Princeton.EDU
Subject: question for script whizzes

Is there an easy way to take the output of this
df -Ik | awk {'print $4 '}

($4 is the free space from df command), and add the resulting numbers
together with dc or bc, in
a script?

thanks.



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:08 EDT