I used chrome devtools to get copy as curl request. but when i run it some failed. so how can i log success and failed url request
i had multiple curl requests stored in file or variable
eg. code
var='curl -X data -H Refferer:http://something.html "url.zip"'
IFS=$'\n'
for f in `echo "$var"`;
do
echo "$f" | bash && echo "$f" | grep -Po 'http.*html' >> success || echo "$f" | grep -Po http.*html >> fail; done
But failed one were not being logged. Can someone help
CodePudding user response:
Grouping the commands solves it
var='curl -X data -H Refferer:http://something.html "url.zip"'
IFS=$'\n'
for f in `echo "$var"`;
do
echo "$f" | bash && { echo "$f" | grep -Po 'http.*html' >> success; } || { echo "$f" | grep -Po http.*html >> fail; }; done