#!/bin/bash
cmds=( step1.sh step2.sh step3.sh step4.sh ) for cmd in ${cmds[@]} do a=`echo ${cmd}" start!"` sh ${cmd} if [ $? -ne 0 ]; then echo ${cmd}" failed!" exit else echo ${cmd}" succeed!" fi done
#!/bin/bash
cmds=( step1.sh step2.sh step3.sh step4.sh ) for cmd in ${cmds[@]} do a=`echo ${cmd}" start!"` sh ${cmd} if [ $? -ne 0 ]; then echo ${cmd}" failed!" exit else echo ${cmd}" succeed!" fi done