mirror of https://github.com/Black-Gold/Learn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
569 B
18 lines
569 B
6 years ago
|
#!/bin/bash
|
||
|
# 测试硬盘空间
|
||
|
DiskSpace=`df -h | awk '{print $5}' | grep % | sort -n | tail -1 | grep -v 已用 | cut -d "%" -f 1`
|
||
|
|
||
|
case $DiskSpace in
|
||
|
[1-6]*)
|
||
|
Message="nothing";;
|
||
|
[7-8]*)
|
||
|
Message="Start thinking about cleaning out some stuff. There's a partition that is $space % full.";;
|
||
|
9[1-8])
|
||
|
Message="Better hurry with that new disk... One partition is $space % full.";;
|
||
|
99)
|
||
|
Message="I'm drowning here! There's a partition at $space %!";;
|
||
|
*)
|
||
|
Message="I seem to be running with an nonexistent amount of disk space...";;
|
||
|
esac
|
||
|
|
||
|
echo $Message
|