I've got a curl command like so:
curl -v --silent --tlsv1.1 https://google.com/ 2>&1 | grep TLS
I'd like to capture the output of that command in a variable. Normally I'd use a subshell to do this, but it doesn't seem to work.
Here's what I'm trying to do:
OUT=$(curl -v --silent --tlsv1.1 https://google.com/ 2>&1 | grep TLS)
echo $OUT
but the command outputs the following (if I'm in a directory with a single file in it called "UNEXPECTED.TXT").
UNEXPECTED.TXT TLS 1.0 connection using TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
So it seems to do a directory listing of the current directory, then append my output to the end of that.
Thanks!