When you run
wget 'https://example.com/prefix'{1..9999}'.html'
the expansion of the {1..9999}
is done by the shell, resulting in an extremely long list of arguments (run echo foo{1..10}
to see what happens).
Instead, you can just run
for i in {1..9999}; do
wget 'https://example.com/prefix'${i}'.html'
done
or (as a one-liner)
for i in {1..9999}; do wget 'https://example.com/prefix'${i}'.html'; done
to have the shell handle the loop directly and not in the arguments passed to wget
. The overall performance of the downloads is limited by the network anyway, so forking and executing 10'000 wget
processes (instead of just one) doesn't have a noticeable impact.
PS: Replace 9999 with whatever the highest number is, or use something like {1,7,9,15,22,36}
for specific numbers.
getconf ARG_MAX
will show the limit. In macOS Catalina it returns:262144
I do not believe you can set it higher or unlimited, but I'm not 100% sure of that and why I'm posting this as a comment.syslimits.h
as:#define ARG_MAX (256 * 1024) /* max bytes for an exec function */
wget
commands and limit the range of sequential files in each command.