leahneukirchen/nq

exec in logfile might fail.

RalphCorderoy opened this issue · 3 comments

The exec in the logfile might fail when the logfile is run, allowing the rest of the logfile to be executed. An explicit `exit', passing exec's failure on, could be added.

I can add that, but do you have an example of how exec can fail?

dash, mksh and zsh quit here upon "bad substitution", bash keeps going...
For "command not found", all four shells stop the script.

You're quite right, I didn't know exec(1) behaved differently to execve(2) in that respect, sorry. bash has its execfail shopt, but there's no way that can take effect AFAICS, set in $SHELL? exec(1posix) here describes the 'exit if non-interactive shell on exec failure' behaviour, and I see it in 7th Ed.'s sh source too. Sorry for the noise.

No problem, but I think this works as-is. The escaping should be ok, so we shouldn't trigger the "bad substitution" "feature" of bash.