#!/bin/bash
JID_JOB1=`sbatch job1.slurm | cut -d " " -f 4`
JID_JOB2=`sbatch --dependency=afternotok:$JID_JOB1 --kill-on-invalid-dep=yes job2.slurm | cut -d " " -f 4`
sbatch --dependency=afterok:$JID_JOB1?afterok:$JIB_JOB2 job3.slurm