Tidy up s3 caching bash script