unable to pass wget a variable with quotes inside the variable

会有一股神秘感。 提交于 2019-11-29 17:35:35

Quotes inside of quoted strings or variables are ordinary characters, not quoting characters. There's no way to change that. Use an array instead:

A=(a b 'c d' 'e f')
cmd "${A[@]}"

calls cmd with four arguments a, b, c d, and e f.

(You could achieve a similar effect with eval, but that's a lot more error prone. In your case, using arrays is much more convenient.)

session="--header=Host: mywebsite.com:9090 --header=User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:20.0) Gecko/20100101 Firefox/20.0"

use this,

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!