9

在不存在/dev/rtc*的嵌入式 Linux 设备上,如何启动控制台窗口,将实时时钟的值写入控制台,在滴答声中,每次更改时?

结果如下:

$ **someCmd**
Mon Mar 14 16:43:22 UTC 2011
Mon Mar 14 16:43:23 UTC 2011
Mon Mar 14 16:43:24 UTC 2011
Mon Mar 14 16:43:25 UTC 2011
Mon Mar 14 16:43:26 UTC 2011

等等

设备armv5tejl运行 BusyBox v1.13.3。

4

2 回答 2

16

使用 watch commad,试试这个: watch -n 1 date

于 2014-06-26T15:39:43.747 回答
12

我不知道 BusyBox shell 支持多少,但在 sh 中你可以这样做:

{ while true ; do date ; sleep 0.1 ; done } | uniq
于 2011-03-14T18:06:33.777 回答