I would like to have this script in a way that I can use it somewhat like this:
cat websites.txt | latency | sort -n
Right now I'm doing:
test.sh
# Sort websites by their response time
# get the list of websites
websites=$(cat websites.txt)
# loop through the websites
for website in $websites
do
# get the response time of the website
response_time=$(curl -o /dev/null -s -w %{time_total} $website)
# print the response time
echo "Response Time for $website is $response_time seconds"
done
I want to use it to find the fediverse instances with the lowest latencies.