curl / Mailing Lists / curl-users / Single Mail

curl-users

Re: curl verbose mode format

From: Thompson, Matt \(GSFC-610.1\)\[SCIENCE SYSTEMS AND APPLICATIONS INC\] via curl- <curl-users_at_cool.haxx.se>
Date: Mon, 22 Jan 2018 07:17:43 -0500

On 01/22/2018 05:32 AM, Keefe Tang via curl-users wrote:
>
> Can someone explain why when I try capturing the verbose output to a
> shell variable, I get the following result and how I can capture the
> same output as I see in terminal?
>
> $ req=$( curl -svo /dev/null https://curl.haxx.se/ 2>&1 ); echo $req

This might be a bash-ism. Try doing:

   echo "$req"

instead. I think the redirect plus echo without quoting will suppress
newlines.

Matt

-- 
Matt Thompson, SSAI, Sr Scientific Programmer/Analyst
NASA GSFC,    Global Modeling and Assimilation Office
Code 610.1,  8800 Greenbelt Rd,  Greenbelt,  MD 20771
Phone: 301-614-6712                 Fax: 301-614-6246
http://science.gsfc.nasa.gov/sed/bio/matthew.thompson
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2018-01-22