1
我喜欢用“时间”来告诉我剧本运行了多久。
如何,我不知道如何获得输出“时间”到一个文件。如何将时间输出写入文件?
time ls -l > outt
不起作用,我只在outt中得到“ls”的输出。
非常感谢。
我喜欢用“时间”来告诉我剧本运行了多久。
如何,我不知道如何获得输出“时间”到一个文件。如何将时间输出写入文件?
time ls -l > outt
不起作用,我只在outt中得到“ls”的输出。
非常感谢。
您可以使用
(time ls -l > outtLs) 2> outt
随着时间一外层上运行,你能想到的,所以我们需要一个括号包含它。
b.t.w 2>表示stderr
如果您有GNU版本,请使用-o
或-a
选项。
GNU选项:
-o FILE, --output=FILE
Do not send the results to stderr, but overwrite the specified file.
-a, --append
(Used together with -o.) Do not overwrite but append.