I need to make a bash script that will download a image with curl and then rename the file, wait 5 mins and then re-download the file and rename it again so that the new file does not replace the old file. I understand the wait and curl download part but I cant make the script recursively rename the new files. It would need to rename the files like: latest.jpg --> latest1.jpg and then the next one latest.jpg --> latest2.jpg. Please help!
#!/bin/bash while true do curl -O link.com/latest.jpg let "i++" mv latest.jpg $ilatest.jpg sleep 5m done