[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: command for disk free ?



* David selby
> echo "$(df)" | grep '/dev/hdb1' | cut -c 53-54

Nitpicking....

1. Why do you echo "$[df)"?  It looks like digging a whole and filling
   it afterwards.  Just use 'df | grep ...'

2. I guess cut -c is ok, but consider a 100% filled disk...  Furter,
   we have to hope that df's output is stable for your script's life
   time.  A slightly more robust approach would be:

   df | grep /dev/hdb1 | awk '{print $5}' | sed 's/%//'

-- 
 Jon Haugsand, Jon-H.Haugsand@norges-bank.no
 http://www.norges-bank.no



Reply to: