Good Good Study. Day Day Up.
分类: LINUX
2018-05-15 10:57:46
当前文件系统,有两个使用率大于60%的文件系统,/和/mnt/suseISO #df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 237M 0 237M 0% /dev tmpfs 244M 0 244M 0% /dev/shm tmpfs 244M 1.8M 243M 1% /run tmpfs 244M 0 244M 0% /sys/fs/cgroup /dev/mapper/system-root 9.8G 5.7G 3.6G 62% / tmpfs 49M 0 49M 0% /run/user/0 /dev/sr0 4.4G 4.4G 0 100% /mnt/suseISO 执行语句1后发现只显示了/目录,执行语句2可以显示/mnt/suseISO目录。不明白为什么这样。 语句1: #df -k|sed '1d'|awk 'sub("%","",$5) {if ($5 > 60) print $6}' / 语句2: #df -k|sed '1d'|awk 'sub("%","",$5) {if ($5 > 10) print $6}' / /mnt/suseISO |
# echo 12% | gawk '{sub("%","",$1);print "$1:"typeof($1); if($1>2)print $1">2";else print $1"<=2"}' $1:string 12<=2 (这个显然不是我们想要的结果) |
# echo 12% | gawk '{sub("%","",$1);print "$1:"typeof($1)" $1+0:" typeof($1+0); if(($1+0)>2)print $1">2";else print $1"<=2"}' $1:string $1+0:number 12>2 |
# echo 12% | gawk '{sub("%","",$1);print "$1:"typeof($1)" strtonum($1):" typeof(strtonum($1)); if(strtonum($1)>2)print $1">2";else print $1"<=2"}' $1:string strtonum($1):number 12>2 |