使用at运行带有标志的.txt文件或命令

时间:2014-07-13 19:09:30

标签: linux bash scheduled-tasks

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

syntax error. Last token seen: b
Garbled time

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

请改为尝试:

echo 'bash myfile.txt' | at midnight

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