1
votes

Hello I want to run this command:

cat webs.txt | xargs -n1 -P8 bash -c 'curl -ks -x http://127.0.0.1:8080 -A "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0'" $0 -m 4 1>/dev/null'

And I have trouble here: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0' with the "'" character, I have tried:

cat webs.txt | xargs -n1 -P8 bash -c 'curl -ks -x http://127.0.0.1:8080 -A "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0\'" $0 -m 4 1>/dev/null'

But it doesn't work, the thing I want is to append '" like this:

Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0'"

Regards

2

2 Answers

2
votes

You may try this xargs:

xargs -n1 -P8 bash -c "url=\"\$0\"; \
curl -ks -x http://127.0.0.1:8080 -A \"Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0'\" \$url -m 4 1>/dev/null" {} < webs.txt
1
votes

You are almost there, some quoting fixes should make it work ok (minor adjustments there like -o/dev/null instead of redirection, moving -m4 ahead):

cat webs.txt | xargs -n1 -P8 bash -c 'curl -m4 -ks -x http://127.0.0.1:8080 -o/dev/null -A "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0" $0'