私は「時間」を使ってスクリプトの実行時間を教えてくれるのが大好きです。
ただし、出力「時間」をファイルに取得する方法がわかりません。
time ls -l > outt
動作しません。outt で「ls」の出力しか得られません。
どうもありがとう。
私は「時間」を使ってスクリプトの実行時間を教えてくれるのが大好きです。
ただし、出力「時間」をファイルに取得する方法がわかりません。
time ls -l > outt
動作しません。outt で「ls」の出力しか得られません。
どうもありがとう。
使用できます
(time ls -l > outtLs) 2> outt
時間は外側のレイヤーで実行されると考えることができるので、それを含むために一対の括弧が必要です.
ところで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.