I just wanted to do a really simple comparison between 2 strings in Bash :
stat=`curl -Is $url | head -n 1`
echo $stat
if [ \"$stat\" = \"HTTP/1.1 200 OK\" ];th
If you think there might be trailing characters (which you don't mind) then use [[
pattern matching instead:
# Try not to use `` anymore, backticks are hard to read
stat=$(curl -Is $url | head -n 1)
# When debugging, use some sort of delimiter which shows leading or trailing whitespace
echo "<$stat>"
# Variables inside [[ don't need to be quoted
# Adding a trailing * allows optional trailing characters
if [[ $stat == "HTTP/1.1 200 OK"* ]];then
echo "$symbol is OK"
echo $stat
$(( valide++ )) # You don't need the "$", just the variable name
else
echo "$symbol is 404"
echo $stat
$(( err++ )) # using a $ in (( )) can change the scan sequence
fi