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

Re: Weird set -u error



On 8/26/22 20:35, David wrote:
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]

.
Why the miss-match, I get the same results as this myself.

Cheers, Gene Heskett.
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/>


Reply to: