# record cli arguments in the log file (in json in case we need to parse this) and stdout (https://stackoverflow.com/questions/418896/how-to-redirect-output-to-a-file-and-stdout)
# read in the job id, using a default value if not set
jobID=${AWS_BATCH_JOB_ID:-"testJobID:"}
# job id format is "job-id:array-job-index", this removes trailing colon (and array index if present) https://stackoverflow.com/questions/3045493/parse-string-with-bash-and-extract-number
jobID=$(echo$jobID| sed 's/\(.*\):\d*/\1/')
# create the filename from the array job index (which won't be set if this is a normal job)