I am using sed for :
RUN=${SLURM_ARRAY_TASK_ID} INPUT_DIR=/path OUTPUT_DIR=/path INPUT_FILE=$(ls $INPUT_DIR/*.txt | sed -n ${RUN}p) SAMPLE=$(basename "$INPUT