Thursday 15 January 2015

bash - Word Splitting on options substitution -


I am unable to set user-agent with empty space in it in the lower shell script. The word is being split in the first place (i.e. "(mcintosh;") as being interpreted by the curl as a URL.

If I type it in the console then it works fine But when I use the replacement.

  PARAMS = "- V" PARAMS = "$ {PARAMS} --User-agent \" Mozilla / 5.0 (Macintosh; Intel Mac OS X 10_8_3) Apple WebKit / 536.28.10 (KHtml, like Gecho) \ "# # do not work #PARAMS =" $ {PARAMS} - user-agent \ "Mozilla / 5.0 \ "#works $ {PARAMS} $ 1> results.txt   

Why can someone explain why?

The problem has been explained

The solution is slightly different syntax.

  PARAMS = (- V) PARAMS + = ("Macintosh; Intel Mac OS X 10_8_3) Apple WebKat / 536.28.10 (khtml)," curl "" $ {PARAMS [@]} "$ 1> results .txt    

No comments:

Post a Comment