I have an pages.txt
file with 100 URLs inside. I want to check them one by one and fail on the first problem. This is what I'm doing:
cat pages.txt | xargs -n 1 curl --silent \
--output /dev/null --write-out '%{url_effective}: %{http_code}\n'; echo $?
Exit code is 1
, but I see it only when the entire file is done. How to stop earlier, on the first problem?
xargs
because of its-P
optionparallel
... It has a lot more flexibility thanxargs
simplistic model...xargs
comes installed on most systems.parallel
always takes an extra installation step. In case that's important to someone.