2007年02月10日13:37 カテゴリLinux timeの出力をリダイレクト 今日研究室の後輩から聞かれたことのメモ。 研究室の後輩に「bash組み込みコマンドのtimeの出力結果をファイルに落としたいんだけど、うまくリダイレクトできない、教えてくれ」、と尋ねられた。ちょっと確認したところ、標準エラーに出力されているようだったので、「2>&1」をつけて実行してみた。 $ time COMMAND 2>&1 > output だけど、COMMANDの出力結果はoutputに出力されたが、timeの出力はそのままコンソールに出力されてしまう。 ちょっと悩んだけど、bashのサブシェル機能(Manpage of BASHを"(list)"で検索)を思い出し、以下のように使ってみたところ見事outputに出力された。 $ (time COMMAND) 2>&1 > output Manpag