[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Weird set -u error



On Fri, 26 Aug 2022 at 22:14, <tomas@tuxteam.de> wrote:

> And then, there's that other riddle: why is a shell invoked from a
> Makefile sourcing /etc/bash.bashrc in the first place?

Hi, my understanding is that the rule commands in the Makefile are run by
a shell, one for each line. The output stream of those commands is usually
stdout (unless redirected), to allow the user to see the output. The shell
detects that the command output is not redirected away from stdout, and so
it starts itself in interactive mode.

'man bash' says:

  When an interactive shell that is not a login shell is started, bash
  reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if
  these files exist. This may be inhibited by using the --norc option.


Reply to: