Write a bash script which checks the Internet speed. We'll use the /tmp folder to…
- User
Write a bash script which checks the Internet speed. We'll use the /tmp folder to download a 100mb file using wget, removes the file, and displays the speed.
Assistant
Here is a bash script to check internet speed by downloading a 100MB file:
#!/bin/bash # File url to download url="http://speedtest.ftp.otenet.gr/files/test100k.db" # File name to save as file="/tmp/speedtest.db" # Start timer start=$(date +%s) # Download file wget $url -O $file # End timer end=$(date +%s) # Calculate download time time=$((end-start)) # Calculate download speed speed=$(echo "scale=2; 100 / $time" | bc) # Print speed echo "Download speed: $speed MB/s" # Remove file rm $fileTo use it, simply make the file executable and run it. It will download a 100MB file from a public server, time the download, calculate the speed, print it out, and then delete the downloaded file.
The key aspects are:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.