管道卷曲回声删除大部分文本
Piping curl to echo removes most text
如果我这样做:
$ 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
的输出?
我认为您的意思是通过管道输入 cat
,而不是 echo
。 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
的输出?
我认为您的意思是通过管道输入 cat
,而不是 echo
。 echo
不接受标准输入的输入。它只是回应了它的论点。