如何通过管道传递或重定向curl -v的输出? [英] How do I pipe or redirect the output of curl -v?

查看:563
本文介绍了如何通过管道传递或重定向curl -v的输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某种原因,输出总是打印到终端上,而不管我是通过2>还是>或|将其重定向.有办法解决这个问题吗?为什么会这样?

For some reason the output always gets printed to the terminal, regardless of whether I redirect it via 2> or > or |. Is there a way to get around this? Why is this happening?

推荐答案

添加-s(静默)选项以删除进度表,然后将stderr重定向到stdout以在与响应正文相同的fd上获取详细输出

add the -s (silent) option to remove the progress meter, then redirect stderr to stdout to get verbose output on the same fd as the response body

curl -vs google.com 2>&1 | less

这篇关于如何通过管道传递或重定向curl -v的输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆