I am trying to parse about 6000 urls from a text file line by line and return their http status code. I have it working for the most part but when my script encounters semi-colons and other various symbols it breaks the script. I am wondering if there is a way to make sure it escapes these characters and still allows cURL to run properly?
This is my code so far:
#!/bin/bash
while read line
do
name=$line
test="curl -s -o /dev/null -I -w "%{http_code}" $name"
eval "$test"
done < $1
This is an example of an error:
./checkURL.sh: eval: line 6: `curl -s -o /dev/null -I -w %{http_code} http://xtblast.com/ptv/?attachment_id=855&repl&replytoco;&replytocom=32954'
./checkURL.sh: eval: line 6: syntax error near unexpected token `;&'