Why does an ampersand in URL cause failure of some command in Mac OS X Terminal?

Posted by congliu on Super User See other posts from Super User or by congliu
Published on 2014-05-31T15:31:12Z Indexed on 2014/05/31 15:33 UTC
Read the original article Hit count: 157

Filed under:
|

Why does an ampersand in URL cause failure of the following command?

I want to open a web page by running Safari in Terminal, placing the URL as an argument.

This works as expected:

open -a safari "http://endic.naver.com/search.nhn?sLn=en&searchOption=all&query=good"

But once the quotes being removed, it wouldn't work as expected:

open -a safari http://endic.naver.com/search.nhn?sLn=en&searchOption=all&query=good

Instead, it returns:

[3] 5395
[4] 5396
[1]   Done                    open -a safari http://endic.naver.com/search.nhn?sLn=en
[2]   Done                    searchOption=all

Seems like ampersand in the URL was treated as "running previous command in the background", though there is no space following the ampersand in the URL.

© Super User or respective owner

Related posts about osx

Related posts about shell