Try following code.
Code:
#!/bin/bash
line=$(df -h | egrep -v '^Filesystem' | head -1)
output=$(echo $line | awk '{ print $5}' | cut -d'%' -f1 )
if [ $output -ge 80 ]; then
echo "Running tar command..."
# add tar command below
else
# do nothing :)
:
fi
You need to add tar command as per your need