On 2023-10-17 10:16:35 -0400, Chet Ramey wrote:
> On 10/13/23 9:18 AM, Vincent Lefevre wrote:
> > The difference seems to be due to the exit status of the last command
> > of the .bashrc file. But this is undocumented.
> 
> How so? The exit status ($?) is the status of "the last command executed,"
> and an interactive non-login shell "reads and executes commands from
> ~/.bashrc."

I still think that this would be worth clarifying.

> > Note that on the opposite, for a login shell, e.g. "bash -l", the
> > exit status of the last command of .bash_logout is ignored for the
> > exit status of bash. So this is confusing.
> 
> Think of it like the EXIT trap. If you run `exit 4', you don't want
> ~/.bash_logout changing that exit status.

Well, this is not obvious as this would still be under the control
of the user, who could restore $? at the end of ~/.bash_logout.

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Reply via email to