#!/bin/bash

# create a unique temp file per tar
tmpfile=$(mktemp /scratch/m4data/tmp-dldata.XXXXXXXX)

# auto-remove the temp file when the script exits for any reason or receives SIGINT/SIGTERM
trap "rm -f $tmpfile" EXIT INT TERM

# make sure that the only output from the script is generated by the `cat` command below
s5cmd cp $1 $tmpfile > /dev/null 2>&1
cat $tmpfile

# note: tmpfile gets autodeleted on exit via trap above
