1

私は「時間」を使ってスクリプトの実行時間を教えてくれるのが大好きです。
ただし、出力「時間」をファイルに取得する方法がわかりません。

time ls -l > outt

動作しません。outt で「ls」の出力しか得られません。
どうもありがとう。

4

2 に答える 2

2

使用できます

(time ls -l > outtLs) 2> outt

時間は外側のレイヤーで実行されると考えることができるので、それを含むために一対の括弧が必要です.
ところで2>はstderrを意味します

于 2013-05-29T05:27:17.987 に答える
1

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.
于 2013-05-29T05:34:40.790 に答える