如何重定向嵌套的linux命令输出

时间:2013-09-24 08:32:34

标签: linux command-line

我有点想达到这样的目的:
time (curl -s $url > /dev/null) >> out.txt
curl 输出将被删除,我保存时间的输出

2 个答案:

答案 0 :(得分:1)

试试这个:

{ time curl -s &url ;} 2>> out.txt

答案 1 :(得分:1)

curl提供了一个指定输出的选项:

   -o, --output <file>
          Write output to <file> instead of stdout. If you are using {} or
          [] to fetch multiple documents, you can use '#'  followed  by  a
          number  in  the <file> specifier. That variable will be replaced
          with the current string for the URL being fetched. Like in:

利用它,并说:

time curl -s $url -o /dev/null >> out.txt