^C [ [emailprotected] 04]# time for i in $(seq 11111);do count= echo ${#char} ;done real 0m8.165s user 0m0.224s sys 0m4.935s [[emailprotected] 04]# time for i in $(seq 11111);do count= echo ${char}|wc -l ;done real 0m26.291s user 0m2.950s s
[ [email protected] 04]# time for i in $(seq 11111);do count=
echo ${#char}
;done
real 0m8.165s
user 0m0.224s
sys 0m4.935s
[[email protected] 04]# time for i in $(seq 11111);do count=echo ${char}|wc -l
;done
real 0m26.291s
user 0m2.950s
sys 0m17.875s
[[email protected] 04]# time for i in $(seq 11111);do count=echo ${char}|wc -m
;done
real 0m26.140s
user 0m3.130s
sys 0m17.769s
[[email protected] 04]# time for i in $(seq 11111);do count=echo ${char}|wc -L
;done
real 0m26.604s
user 0m3.115s
sys 0m18.451s
[[email protected] 04]# time for i in $(seq 11111);do count=expr length $char
;done
real 0m16.735s
user 0m1.701s
sys 0m13.930s
感觉,当一个命令需要输出的时候,能用命令自带的命令就不用管道输出。