Hi,
I am trying to develop a script 1 liner to check disk usage on file system, if it is more than 80% it should send email if it is less than than it should echo say "Do nothing"
However for both of them I am having some syntax problems
1)if [[ (df -P|egrep -i 'test'|awk '{print$5}'|sed 's/%//') >= 80 ]]; then mailx -s "test FULL"
testme@testmail.com else echo "do nothing" fi
I am getting error message like.
-bash: conditional binary operator expected
-bash: expected `)'
-bash: syntax error near `|'
If I do with single square brackets.
2) if [ (df -P|egrep -i 'test' |awk '{print$5}'|sed 's/%//') >= 80 ]; then mailx -s "test is FULL"
testme@testmail.com else echo "do nothing" fi
-bash: syntax error near unexpected token `df'
What the heck is difference between if with single and double square brackets Guru's?
Please assist in my understanding.
Many thanks.