0

I am measuring performance of different URL's that are stored in a file

Url.txt looks like:



http:://localhost:8080/bankDetail
http://localhost:8080/bankAccount
http://localhost:8081/hi

Shell Script

while read line 
do 
    echo $line #content printed here fine 
    curl -w "@curl-format.txt" -o /dev/null -s $line

done < url.txt
    

But the curl command returns time_total = 0.00000s as if it is not working properly.

  • Try adding `-S` (uppercase "S") to curl's options to see if there are any error messages. Also, confirm that the input file uses LF line endings (see https://stackoverflow.com/questions/800030/remove-carriage-return-in-unix). Also also, quote parameter expansions: `$line` --> `"$line"` – rowboat Aug 04 '22 at 06:38
  • @rowboat Thank you, The issue was the carriage returns. I removed them and now it works. – Abdullah Chaudhry Aug 04 '22 at 06:50

1 Answers1

1

Used this command to remove carriage returns from the file.

tr -d '\r' < url.txt > new_url.txt

Then used new_url.txt in the code and it works now.