使用 bash 在终端中显示运行时钟而不使用循环

Vij*_*y47 3 linux bash

如何在不使用任何 for 或 while 循环的情况下在 linux 终端中显示正在运行的时钟。在持续时间为 1 秒的脚本中使用这些循环会导致系统负载很大。

Ram*_*pal 6

怎么样:

watch -n 1 date
Run Code Online (Sandbox Code Playgroud)

使用 watch 定期运行命令。