管道卷曲到回声删除大多数文本

时间:2018-03-06 02:43:11

标签: curl pipe echo

如果我这样做:

$ curl https://en.wikipedia.org/wiki/CURL | less

我看到了维基百科页面的HTML内容。但是,如果我这样做:

$ curl https://en.wikipedia.org/wiki/CURL | echo

我所看到的只有:

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                               Dload  Upload   Total   Spent    Left  Speed
7 59808    7  4729    0     0  13793      0  0:00:04 --:--:--  0:00:04 13787
curl: (23) Failed writing body (667 != 1300)

我尝试使用here中的解决方案,但之后:

$ curl https://en.wikipedia.org/wiki/CURL | tac | tac |echo

我明白了:

 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                Dload  Upload   Total   Spent    Left  Speed
100 59808  100 59808    0     0   144k      0 --:--:-- --:--:-- --:--:--  144k

这是进步,因为没有Failed writing body,但它仍然没有给我我想要的东西(回应那个维基百科页面的html)。

那么,我怎样才能回显curl的输出?

1 个答案:

答案 0 :(得分:2)

我认为您的意思是管道cat,而不是echoecho不接受stdin的输入。它只是回应它的论点。