I have a script:
ACTION="build"
env -i
exec ./makelib.sh Release "${ACTION}"
env -i
exec ./makelib.sh Debug "${ACTION}"
Second exec does not execute. Why, and how can I execute it?
I have a script:
ACTION="build"
env -i
exec ./makelib.sh Release "${ACTION}"
env -i
exec ./makelib.sh Debug "${ACTION}"
Second exec does not execute. Why, and how can I execute it?
exec will replace the entire process with the contents of the command you're passing in--in this case, makelib.sh. Check out the man page for the linux exec function--it explains it in depth.
I assume this is a shell script; if you want the script to simply RUN the other scripts sequentially (one after the other), you'll use:
This will run
./makelib.sh Release "${ACTION}"
first; after it finishes, it will run./makelib.sh Debug "${ACTION}"
. If you want both commands to run in parallel (at the same time), you can background the process using&
.Keep in mind that background both processes means you'll have two processes running (and outputting!) simultaneously. So if you have logging output, your screen will get messy, to say the least.
Hope this helps!
exec is substituting the current shell by the commands passed. If you want the script to continue, remove the exec statement(s).
What about adding the "&" character to the end of the line if you want it to run in the background, or "&&" between the first and second statements if you want the second to be conditional on the first being successful?
(My shell-fu is weak, so I'd love to hear why this may be wrong, for educational purposes.)