title: df command works in terminal, but not in bash script
body: <p>I found the code below on a website.  I know what it does and understand it, but I can't get it to work correctly.  When I run it in Redhat 6.10, I get an error stating, "line 6: [: /: integer expression expected".</p>
  
  <p>When I run the df code from the CURRENT variable in the terminal it outputs "21".  When it's in the script, it outputs "/".</p>
  
  <p>What I'm trying to get it to do is e-mail me if the "/" directory gets over 50%.  Any ideas why the df portion of the code is working in the terminal, but not in the script?</p>
  
  <pre><code>#!/bin/bash
  
  CURRENT=$(df / | grep / | awk '{ print $5}' | sed 's/%//g')
  THRESHOLD=50
  
  if [ "$CURRENT" -gt "$THRESHOLD" ] ; then
          mail -s 'Disk Space Alert' E-MAIL REMOVED &lt;&lt; EOF
  Your root partition remaining free space is critically low. Used: $CURRENT%
  EOF
  fi
  </code></pre>