I'm trying to print just the verbose sections of a cURL request (which are sent to stderr
) from the bash shell.
But when I redirect stdout
like this:
curl -v http://somehost/somepage > /dev/null
Some sort of results table appears in the middle of the output to stderr
:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
Followed by this near the end:
{ [data not shown]
118 592 0 592 0 0 15714 0 --:--:-- --:--:-- --:--:-- 25739
Which makes the response headers less readable.
I don't see this text when not redirecting.
Another way to see the effects:
Table doesn't appear:
curl -v http://somehost/somepage 2>&1
Table appears:
curl -v http://somehost/somepage 2>&1 | cat
1) How come this shows up only with certain types of redirects?
2) What's the neatest way to suppress it?
Thank you
Best Answer
Try this:
That will suppress the progress meter, send
stdout
to/dev/null
and redirectstderr
(the-v
output) tostdout
.