數位時鐘(while迴圈)
執行以下指令,看看顯示效果
date +'%Y %b %e 星期%a%n%I:%M:%S %p'
使用 while loop 製作時鐘(while 條件;do ....;done)
date +'%Y %b %e 星期%a%n%I:%M:%S %p'
while sleep 1
do
#始終保持游標向上移動兩行
tput cuu 2
#顯示時間
date +'%Y %b %e 星期%a%n%I:%M:%S %p'
done
Last updated
Was this helpful?