On 20/05/2016 18:44, Max Ivanov wrote:
Pretty much yes. Don't set ENV variable to the output value of a prog if prog exited with anything but 0 (== that is what I call error, but commands in execline make distinction between error codes and "exit due to signal", so backtick might need to do it too to be consistent)
backtick -i doesn't make the distinction; I don't think it's relevant here. No matter whether the subprocess crashes or just fails, you don't want to proceed normally with the substitution.
Whether to unset variable on error or not I have no opinion. If env var was present already and backtick is called to overwrite it, somebody might prefer it to be left with previous value, but for others natural behavior might be to undefine it.
I'm not sure either. On the one hand, there's already the -D mechanism if people want to have a default; on the other hand, it's easy to do "unexport VAR" before the backtick. I'll probably go with what's easiest to code. -- Laurent