Further tidy up s3 caching bash script