Revision: 29302
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 26, 2010 14:56 by mprabhuram
Initial Code
#!/bin/sh # The file which will save the current position in the job BREAKPOINT=/mydir/breakpoint MAXPROCEDURE=3 # # All the global variables should be declared here # save_break_point() { echo $BP >$BREAKPOINT } procedure_1() { # First part of the job echo procedure 1 } procedure_2() { # Second part of the job echo procedure 2 } procedure_3() { # Third part of the job echo procedure 3 } # # Initial state [ -e $BREAKPOINT ] && BP=`cat $BREAKPOINT | sed 's/^\([0-9]*\).*$/\1/'` [ "$BP" = "" ] && BP=1 # Process each function based on the breakpoint while [ $BP -le $MAXPROCEDURE ] do procedure_$BP save_break_point BP=`expr $BP + 1` done [ -e $BREAKPOINT ] && rm -f $BREAKPOINT
Initial URL
http://www.linuxquestions.org/questions/programming-9/bash-goto-384407/
Initial Description
you could divide your job into functions Here, procedure_1 is the first part of the job, where there isn't restart, procedure_2 must be executed if procedure_1 was done and the control logic is at the end, working as an outer loop.
Initial Title
Unix Script control flow
Initial Tags
Initial Language
Bash