Using curl in a bash script and getting curl: (3) Illegal characters found in URL April 18, 2023 by Tarik The $URL contains a \r (CR) at the end (0d). Remove it with URL=${URL%$'\r'} before using it with curl.