为什么 echo 很特殊
『回复列表(52|隐藏机器人聊天)』
wsl 1
还是很慢,比我手机慢 3 ~ 6 倍。。
<echo $uid . ',' . mt_rand(0, 255) . "\n">
real 0m14.348s
user 0m10.306s
sys 0m3.968s
<echo $uid , ',' , mt_rand(0, 255) , "\n">
real 0m31.896s
user 0m16.267s
sys 0m15.480s
<printf($uid . ',' . mt_rand(0, 255) . "\n")>
real 0m16.574s
user 0m11.762s
sys 0m4.733s
<printf("%d,%d\n", $uid, mt_rand(0, 255))>
real 0m13.303s
user 0m8.735s
sys 0m4.503s
wsl 1
结果<echo $uid . ',' . mt_rand(0, 255) . "\n">
real 0m49.888s
user 0m16.672s
sys 0m33.219s
<echo $uid , ',' , mt_rand(0, 255) , "\n">
real 3m2.751s
user 0m46.047s
sys 2m16.688s
<printf($uid . ',' . mt_rand(0, 255) . "\n")>
real 0m54.545s
user 0m19.188s
sys 0m35.297s
<printf("%d,%d\n", $uid, mt_rand(0, 255))>
real 0m52.145s
user 0m17.234s
sys 0m34.906s
修复EOF不在行首导致出错
不会出错啊
The format of here-documents is:
[n]<<[-]word here-document delimiter
If the redirection operator is <<-, then all leading tab characters are stripped from input lines and the line containing delimiter. This allows here-documents within shell scripts to be indented in a natural fashion.