The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 08-23-2007
ghostdog74 ghostdog74 is offline
Registered User
 

Join Date: Sep 2006
Posts: 1,582
that's very kludgy. the usage of awk is more than meets the eye
try this
Code:
df -k | awk 'int($5) > 95{ 
  subject = $1 " More than 95% disk usage "
  email = "email@test.com"
  cmd = "mailx -s \"" subject "\" " email
  cmd  | getline #or system(cmd)
  }
'
Reply With Quote