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

Re: Weird set -u error



On Sat, 27 Aug 2022 at 10:27, Greg Wooledge <greg@wooledge.org> wrote:
> On Sat, Aug 27, 2022 at 10:21:08AM +1000, David wrote:

> > Just sharing something that I tried, to shed some more light
> > on this, in case that's useful ...
> >
> > $ foo() { case "$-" in *i* ) i=interactive ;; * ) i=not-interactive ;;
> > esac ; echo $BASHPID $i ; }
> > $ declare -fx foo
> > $ foo
> > 2415 interactive
> > $ foo ; ( foo ) ; foo
> > 2415 interactive
> > 2512 interactive
> > 2415 interactive
> > $ bash -c foo
> > 2515 not-interactive
> > $ foo ; ( bash -c foo ) ; foo
> > 2415 interactive
> > 2516 not-interactive
> > 2415 interactive
> > $ foo ; ( foo ; bash -c foo ; foo ) ; foo
> > 2415 interactive
> > 2517 interactive
> > 2518 not-interactive
> > 2517 interactive
> > 2415 interactive
>
> I get these results as well, with Debian 11's packaged bash.

Yeah, sorry, I forgot to include, for the record:

$ echo $BASH_VERSION
5.1.4(1)-release
$ apt list --installed bash
Listing... Done
bash/stable,now 5.1-2+deb11u1 amd64 [installed]


Reply to: