What exactly do you see? With the script
opts="-x ''"
echo curl http://somepage $opts
opts="-x \'\'"
echo curl http://somepage $opts
With bash 3.2.39 or 4.1.5, I see
+ opts='-x '\'''\'''
+ echo curl http://somepage -x ''\'''\'''
curl http://somepage -x ''
+ opts='-x \'\''\'\'''
+ echo curl http://somepage -x '\'\''\'\'''
The first call to curl (well, echo curl) has a last argument consisting of two characters ''. The trace escapes special characters: ' appears as '\'' (a common idiom to “escape” single quotes inside single quotes). Formally, ''\'''\''' consists of an empty single-quoted string '' followed by the backslash-quoted character \', then again '', again \', and a final ''. (Ksh shows this as the slightly more readable $'\'\''.) The second call passes four characters \'\'.
Under the normal sh parsing rules, you can't make an empty argument by expanding an unquoted variable. Word splitting cuts only where there's a non-whitespace or quoted character.
Since you're using bash, you can put multiple options in an array. This also works in ksh and zsh.
opts=(-x "")
curl http://somepage "${opts[@]}"
For this particular case, you can override the environment variable instead.
http_proxy= curl http://somepage
bash <file>is used, then it is bash, irrespective of filename. (I have yet to see a shell that emulates 'bash' down to providing a binary with the same name...) – grawity May 10 '11 at 20:22