傅令江的光影色彩世界
shell判断文件的大小
2014-11-25 令狐江
c=`du -s /etc/fu/tmp/ | awk '{print $1}'`
if [ $c -gt 600000 ]
then
        echo "<br/>The <b>$one</b> $a KB " >> /one.html
else

fi

小于
#!/bin/bash
fsize=$(/bin/ls -l /etc/fu/tmp/index.html | cut -d' ' -f 5)
if [ $fsize -lt 1024 ]; then
  echo "too small"
fi

大于
fsize=$(/bin/ls -l /etc/fu/tmp/index.html | cut -d' ' -f 5)
if [ $fsize  -gt 32400  ]; then
echo "too big"
fi
发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容