Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 694 Bytes

handling_shell_sensitive_characters_in_url.md

File metadata and controls

24 lines (17 loc) · 694 Bytes

Handling shell sensitive characters in URL

Sometimes you want to request an URL from the command-line, but the URL contains characters bearing meaning in your shell.

$ curl --header Accept:application/json https://USERID:funkyPassMo|)@eksempel.dk/dostuff
-bash: syntax error near unexpected token '|'

Simply quote the URL

$ curl --header Accept:application/json \
"https://USERID:funkyPassMo|)@eksempel.dk/dostuff"

And if your special character is a quote ", quote differently, use ' for example

$ curl --header Accept:application/json \
'https://USERID:funky"PassMo|)@eksempel.dk/dostuff'

See also: http://wiki.bash-hackers.org/syntax/quoting