v**t 发帖数: 25 | 1 我用$>time cat filename > test.dat时
test.dat的内容是 cat filename 的结果。
但time的结果还是显示在终端上,而没有输入到filename中。
另外我用$>time command 〉tmp 时,tmp内容为空,time
的结果显示在终端上 |
o***z 发帖数: 133 | 2 /usr/bin/time
【在 v**t 的大作中提到】 : 我用$>time cat filename > test.dat时 : test.dat的内容是 cat filename 的结果。 : 但time的结果还是显示在终端上,而没有输入到filename中。 : 另外我用$>time command 〉tmp 时,tmp内容为空,time : 的结果显示在终端上
|
t****n 发帖数: 1347 | 3 (time cat filename) > test.dat
【在 v**t 的大作中提到】 : 我用$>time cat filename > test.dat时 : test.dat的内容是 cat filename 的结果。 : 但time的结果还是显示在终端上,而没有输入到filename中。 : 另外我用$>time command 〉tmp 时,tmp内容为空,time : 的结果显示在终端上
|
r**a 发帖数: 630 | 4
It does NOT work.
两年前俺就发现time的输出不能重定向,即使俺把stderr重定向到stdout后再重定向到文件
都不行,当时只好用script这个命令解决了。
【在 t****n 的大作中提到】 : (time cat filename) > test.dat
|
q*****m 发帖数: 73 | 5
I posted this on Linux board:
for sh/bash,
%time cat filename 2> time.out
for csh/tcsh/bash
%(time cat finename) >& time.out
Does this work for you?
【在 r**a 的大作中提到】 : : It does NOT work. : 两年前俺就发现time的输出不能重定向,即使俺把stderr重定向到stdout后再重定向到文件 : 都不行,当时只好用script这个命令解决了。
|
v**t 发帖数: 25 | 6 The sencond one can use. Thank you very much.
【在 q*****m 的大作中提到】 : : I posted this on Linux board: : for sh/bash, : %time cat filename 2> time.out : for csh/tcsh/bash : %(time cat finename) >& time.out : Does this work for you?
|
r**a 发帖数: 630 | 7 在sh/bash中可以用:
(time cat filename) > time.out 2>&1
刚才俺才意识到问什么我以前在bash中用time cat filename > time.out 2>&1 (就是俺说
的把stderr重定向到stdout后再重定向到文件)行不通,原来是time认为它的参数是
cat filename > time.out 2&1,故而其输出根本就没有被重定向,而是cat的输出被重定
向了,FT!!!!! 现在强行规定了命令执行顺序就好了。
BTW I/O redirection in csh is not consistent with other shells, and csh itself
is not suitable to be used to write scripts, so I almost never use it.
【在 q*****m 的大作中提到】 : : I posted this on Linux board: : for sh/bash, : %time cat filename 2> time.out : for csh/tcsh/bash : %(time cat finename) >& time.out : Does this work for you?
|