###start script####
#!/bin/bash
fs="/"
fs_total=`df -k $fs | tail -n 1 | awk '{print $2}'`
fs_used=`df -k $fs | tail -n 1 | awk '{print $3}'`
percent_used=$((100*$fs_used/$fs_total))
echo "$fs is at ${percent_used}% capacity"
测试过可以使用,直接复制即可