【问题标题】:Terminal Run Code for n seconds终端运行代码 n 秒
【发布时间】:2010-10-03 14:30:42
【问题描述】:

我已经搜索过这个,但还没有找到一个命令 - 我将如何在终端上运行 say hello.o 持续 n 秒。?

【问题讨论】:

    标签: terminal command


    【解决方案1】:
     watch -n 60 hello.o
    

    如果你想运行 hello.o n 秒 X 次

    x=0
    n=60
    while [ "$x" -lt 10 ]; do ./hello.o; ((x++));sleep $n; done
    

    【讨论】:

    • 这将永远每 60 秒运行一次 hello.o
    猜你喜欢
    • 2016-04-17
    • 1970-01-01
    • 2011-03-24
    • 2022-12-11
    • 1970-01-01
    • 2013-04-14
    • 2012-09-04
    • 2019-08-24
    • 1970-01-01
    相关资源
    最近更新 更多