In bash you test like this for problems that can be caused by non-printable characters since if you don't know how to identify it because it basically breaks your script.
echo "url=$url" should print something like this normally if you have properly formatted input/text:
But if you have some weird hidden characters (not visible in a text editor of any sort you'll get something like this
How come it doesn't print as expected?
There are hidden/non-printable characters, usually ASCII code I believe that cause unexpected behavior like above and wreaks havoc on many scripts/programs who didn't realize this since there are non-printable characters.
There is a program in Linux that takes care of it called "tr"
If I read data line by line using cat, I now use "tr" to filter all the non-printable characters (I use it line by line and not the entire file since this would remove things like linebreaks and then you have a text file that becomes a single line).
Here is how you'd fix a bad variable (one with non-printable/special characters):
url=`echo "$url"|tr -dc ‘[:print:]‘
bash, printable, characters, spacein, echo, quot, url, formatted, input, text, http, someaddress, visible, ll, doesn, ascii, wreaks, havoc, scripts, programs, didn, linux, tr, filter, linebreaks, variable, dc, lsquo,