Why does an ampersand in URL cause failure of some command in Mac OS X Terminal?
- by congliu
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.