### Avoiding newlines by 'echo' command
Instead of `echo`, use `echo -n`.
If that does not work (e.g. on OSX with `/bin/sh` as shell), or if you want make your script independent of which shell it runs under, use `/bin/echo -n `.
### Avoiding newlines from "payload" (here: '$key')
Change the output newlines with `tr`, e.g.
echo "$url/$key" | tr '\
' '|'