On Wed, Mar 02, 2011 at 08:42:34PM +0000, Jonathan Nieder wrote: > Tim Allen wrote: > > > The POSIX specification for the dot command states: > > > > EXIT STATUS > > Returns the value of the last command executed, or a zero exit > > status if no command is executed. > > > > If an empty file is sourced, then "no command is executed" > > I agree. Looking through "git log --patch src/main.c", though, I find > v0.5.3~42 (Do not clobber exit status in dotcmd., 2005-03-03), which > appears to have been meant to take care of the following case: > > $ cat printstatus.sh > echo $? > $ false > $ . ./printstatus.sh > 1 > > I wonder if the following on top might help (imitating evalcmd)?
Patch applied. Thanks a lot! Of course this does rely on evaltree actually setting exitstatus, which it doesn't always do due to oversights. For example, evalpipe doesn't set exitstatus if the pipeline is backgrounded. Amusingly pdksh seems to share this bug. Cheers, -- Email: Herbert Xu <herb...@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe dash" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html