I'm trying to create a script on bash shell, containing 4 python scripts, I have sorted them in order to execute them sequentially, how do I make a condition if anyone of them not executed or returned any error then stop the shell
#!/bin/bash -x cd /home/hadoop/Traffic_Stat_Process python3 Table_Dropper.py /usr/bin/spark-submit --jars /home/hadoop/vertica/lib/vertica-jdbc-9.1.1-0.jar Spark_JDBC_Connector.py hadoop fs -rm -r /hadoopData/hive/warehouse/temp python3 2th_phase.py python3 3th_phase.py
if ! python3 arg; then echo "python3 arg failed" >&2; exit 1; fi.if ! /usr/bin/spark-submit --jars /home/hadoop/vertica/lib/vertica-jdbc-9.1.1-0.jar Spark_JDBC_Connector.py ; then echo "the spark-submit failed" >&2; exit ; fi|| exitafter any command you want to terminate the script on exit; there's alsoset -e, but there are compelling reasons to avoid it. Nothing about this is specific to Python, so the title can probably be focused a bit.