Wget 执行同一个调用 10 次的语法

Syntax for Wget to execute same call 10 times

有没有办法通过 wget 按顺序调用同一个 url 10 次,而不是手动再次发送相同的调用?谢谢!! 例如,我可以让调用执行 10 次而不是手动发送此调用吗? 时间 wget -O test.txt --no-check-certificate https:google.com

我基本上是在尝试使用此方法获取 url 的平均响应时间。

解决方案 1:

Create a text file "input.txt" with the same URL copied 10 times, 1 per line.

Then, add "-i input.txt" to your wget command instead of "https:google.com" (which >is incorrect anyway).

This will make wget call the same URL 10 times.

解决方案 2:

Assuming your shell is bash, you can call wget in a loop like so -

for x in {1..10}; do time wget -O test.txt --no-check-certificate https://google.com ; done ;

This will also call wget 10 times for the same URL.

这两种方法有什么区别?

Solution1 will call the URL 10 times from a single wget instance and Solution2 will spawn a new wget instance for each of the 10 attempts.

谢谢,我基本上做了同样的事情来解决问题,方法是用新响应覆盖文件 - 我尝试通过文件调用 url 对我不起作用