【问题标题】:Using at to run a .txt file or command with flags使用 at 运行带有标志的 .txt 文件或命令
【发布时间】:2014-07-13 19:09:30
【问题描述】:

我需要在特定时间使用 at 运行(在 bash 中)一个 .txt 文件,该文件包含由另一个程序写入的一堆命令。通常我会用bash myfile.txt 运行它,但我选择运行at bash myfile.txt midnight 它不喜欢它,说

syntax error. Last token seen: b
Garbled time

我该如何解决这个问题?

【问题讨论】:

    标签: linux bash scheduled-tasks


    【解决方案1】:

    试试这个:

    echo 'bash myfile.txt' | at midnight
    

    at从标准输入或指定文件中读取命令(参数-f filename);不是从命令行。

    【讨论】:

    • 哎呀,这很明显:P 非常感谢,我应该看到的。
    猜你喜欢
    • 2022-01-25
    • 2012-11-14
    • 2016-12-18
    • 1970-01-01
    • 2015-05-03
    • 1970-01-01
    • 1970-01-01
    • 2021-11-25
    • 2021-11-11
    相关资源
    最近更新 更多