Curl in bash code - produces wrong status

1

This code seems to ouput a http status of 000 - which seems to indicate something didn't connect properly but when I do this curl outside of the bash script it works fine and produces a 200 so something with this code is off... any guidance?

#!/bin/bash

URLs=$(cat test.txt | grep Url | awk -F\  ' { print $2 } ')
# printf "Preparing to check $URLs \n"
for line in $URLs
    do curl  -L -s -w "%{http_code} %{url_effective}\\n" $line
done

Tony

Posted 2015-12-09T17:40:33.430

Reputation: 241

What is the value of $line when that happens? – glenn jackman – 2015-12-09T18:16:11.937

I dunno - how do I find out? suppose I can echo line head of the command? – Tony – 2015-12-09T18:17:51.503

This might help: How to debug a bash script?

– Cyrus – 2015-12-10T04:01:56.967

No answers