This question already has an answer here:

var=$(du -s /data/dir1/ | awk '{print $1}')
if [$var -ge 5000]; then
   echo "The size is more $var"
   echo "The size is less $var"

The du command works fine at shell. When I include in script, I get "command not found" error. What is the problem in this script ?

marked as duplicate by Kusalananda shell-script Mar 25 at 8:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Thanks for the link to resolve white space problem – user2439245 Mar 25 at 9:48

Browse other questions tagged or ask your own question.