A line copied from a CRLF file can look like proxy.example:8080 while the variable actually ends with a carriage return. Quoting the variable preserves that character; it does not remove it.

For a Bash file containing one complete proxy URL per line:

target='https://api.example/'
while IFS= read -r proxy || [ -n "$proxy" ]; do
    proxy=${proxy%$'\r'}
    if [ -z "$proxy" ]; then
        continue
    fi
    curl --proxy "$proxy" --max-time 10 --url "$target"
done < ProxyList.txt

Use entries such as http://proxy.example:8080; the HTTP proxy list supplies public address candidates to format that way. read removes the newline delimiter; the suffix expansion removes one trailing CR if present. The condition also processes a final nonempty line without a newline.

IFS= prevents field splitting during read, and -r preserves literal backslashes. Double quotes then pass the resulting URL as one curl argument. Avoid iterating over command-substitution output: shell word splitting can alter the file’s record boundaries before curl sees them.

This normalizes line endings. It does not fix a wrong listener protocol, missing endpoint, or unreachable service.

Artihkkalat mat laktásit