linux-bash-使用-while-loop,关联,script, shell,循环
The syntax of a while loop in BASH is something like below:
1 2 3 4 5 | while [ condition ]; do # statements # commands done |
应用/技巧
每秒钟打印一次CPU的当前频率:
1 | while true ; do (sleep 1) && (lscpu | grep --color 'CPU MHz'); done |
每秒钟打印一次CPU的当前频率、温度:
1 | while true ; do (sleep 1) && (lscpu | grep --color 'CPU MHz') && (sensors | grep Tctl); done |