#!/bin/bash for i in {1..1000};do echo "同窗們好" >> passwd du -h passwd | awk -F'k' '{print $1}' | awk -F'.' '{print $1}' sizeme=`du -h passwd | awk -F'k' '{print $1}' | awk -F'.' '{print $1}'` if test $sizeme -gt 100;then echo "文件超過100k" break fi done