I am a novice, so please don't be too technical !
I have written 3 separate scripts which all work OK.
I now need to merge them into one big script.
I would like to introduce a runtime parameter,
to allow me to restart at script2 or script3.
I would prefer not to use functions, as I haven't done the training.
How do I define the labels in the big script ?
And how do I code at the beginning of the big script
to send control to the restart positions ?
Many thanks.

Recommended Answers

All 3 Replies

I do not understand what you intend from your description. It is easy enough to merge the three scripts:

#do the first one
path_to_script_one $parameters_for_script_one
# do the second one
path_to_script_two # maybe this one doesn't need params
# etc

If I guess correctly what you want, you could wrap it all in a loop, and run each of the scripts only if the (label?) is appropriate for that script to be run, then exit from the loop only if the (label?) is a value that indicates it is time to stop.

You could have the individual scripts return a (label?) or you could interact with the user, or maybe something else: Your question was not clear.

I am a novice, so please don't be too technical !
I have written 3 separate scripts which all work OK.
I now need to merge them into one big script.
I would like to introduce a runtime parameter,
to allow me to restart at script2 or script3.
I would prefer not to use functions, as I haven't done the training.


Then it's time you learned, because functions are the only sensible way to do it.

f1() {
 : script 1 here
}

f2() {
 : script 2 here
}

f3() {
 : script 3 here
}

case $1 in
     1) f1 ;;
     2) f2 ;;
     3) f3 ;;
esac

How do I define the labels in the big script ?


There are no labels in shell scripts.

Thanks to both griswolf & cfa.
The need to join the scripts is no longer required, but I will try to implement the above when I am not so busy, as I agree with cfa that I should learn functions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.