Hello John,
* John Richetta wrote on Wed, Sep 10, 2008 at 05:12:17AM CEST:
If I want to execute a script between a top level make invocation
and a
submake, it appears that the only straightforward way to do it
that is
likely to be portable and reliable(?) is to redefine $MAKE. If I
understand correctly, the right way to do this is as follows.
That looks really awkward and rather fragile. Please go back one step
and describe what you really would like to achieve, rather than how
you
think it would be best to achieve it. Maybe there is a better way.
CommandToExec = "$@"
...
Result = exec "${CommandToExec}"
exit ${Result}
I am not sure if this is to be meta-language, but if it is to be
shell,
then it should rather be something like
# the command is passed in the positional parameters.
exec "$@"
exit 1
exec does not return at all if the command can be found and executed.
If the script is continued after the exec, it means the execution
failed. If it worked, the exit status of the process is that of the
exec'ed command.