1

Why Zsh time not work for some commands,

➜  ~ type time
time is a reserved word
➜  ~ time sleep 1
sleep 1  0.00s user 0.00s system 0% cpu 1.004 total
# not work for echo
➜  ~ time echo hello
hello
# not work with for 
➜  ~ time for i in {1..3}; do curl -s http://baidu.com > /dev/null; done

but if change to bash these commands are both supported,

➜  ~ exec bash
bash-3.2$ type time
time is a shell keyword
$ time echo hello
hello

real    0m0.000s
user    0m0.000s
sys 0m0.000s

bash-3.2$ time for i in {1..3}; do curl -s http://baidu.com > /dev/null; done

real    0m0.099s
user    0m0.019s
sys 0m0.018s
zhuguowei
  • 191

0 Answers0