Error messages for fatal error e.g. ${x?foo} or rovar=foo or $x expanded with nounset, report an error message prefixed by the string "environment:" instead of "scriptname:" (or "$0:").
$ bash -c '${x?hi}' asd asd: line 1: x: hi $ bash -c 'a () { ${x?hi} ;}; a' asd environment: line 1: x: hi $ bash -c 'readonly x=x; x=y' asd asd: line 1: x: readonly variable $ bash -c 'readonly x=x; a () { x=y ;}; a' environment: line 1: x: readonly variable $ bash -uc '$x' asd asd: line 1: x: unbound variable $ bash -uc 'a () { $x ;}; a' asd environment: line 1: x: unbound variable This bug seems to have been introduced in Bash 4.4: $ bash43 -c '${x?hi}' asd asd: x: unbound variable $ bash43 -c 'a () { ${x?hi} ;}; a' asd asd: x: unbound variable $ bash44 -c '${x?hi}' asd asd: x: unbound variable $ bash44 -c 'a () { ${x?hi} ;}; a' asd environment: x: unbound variable o/ emanuele6