|
他们都有显示信息的命令,但是还有些不同,请看下列比较.
用echo:
#! /bin/bash
x=200
while (( count < 5000 ))
do
echo $x > /dev/null
(( count=count+1 ))
(( (count%1000) == 0 )) && echo "...running..."
done
用printf:
#! /bin/bash
x=200
while (( count < 5000 ))
do
printf $x > /dev/null
(( count = count +1 ))
(( (count%1000) == 0 )) && printf "\n...running..."
done
然后用time一下两个结果,有什么区别呢? |
|