I have a bash script that iterates over a folder of sql scripts. I want it to run intelligently when the script encounters an error. I don't want to run a step twice.
for a in $files_list; do
command 1
command 2
.
.
done
If 1,2,3,4,5 are the files to be executed and script exits at step 3 with some error. In next execution, I want to run from step 3 only. I have a variable in place for detecting at which step the script exited. I am stuck at starting the iteration from that variable. Is it something that can be done? Any suggestion is accepted. I'm open to change my logic as well.