bug-bash
[Top][All Lists]
Advanced

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

Re: Warn upon "declare -ax"


From: Zachary Santer
Subject: Re: Warn upon "declare -ax"
Date: Tue, 5 Sep 2023 10:03:22 -0400

Woops.

On Mon, Sep 4, 2023 at 10:16 PM Zachary Santer <zsanter@gmail.com> wrote:

> On Mon, Sep 4, 2023 at 8:46 AM Léa Gris <lea.gris@noiraude.net> wrote:
>
>> There don's seem to be any warning system in Bash or other shells. As
>> long as it is not a fatal error condition and errexit is not set,
>> execution continue.
>>
>
> $ coproc cat_coproc_1 { cat; }
> [14] 7892
>
> $ coproc cat_coproc_2 { cat; }
> -bash: warning: execute_coproc: coproc [7892:cat_coproc_1] still exists
> [15] 7894
>
> $ grep -B2 -n -F -e 'warning' -- po/bash.pot
> 170-#: builtins/common.c:134 error.c:264
> 171-#, c-format
> 172:msgid "warning: "
> --
> 333-
> 334-#: builtins/complete.def:696
> 335:msgid "warning: -F option may not work as you expect"
> --
> 337-
> 338-#: builtins/complete.def:698
> 339:msgid "warning: -C option may not work as you expect"
> --
> 649-#: builtins/printf.def:734
> 650-#, c-format
> 651:msgid "warning: %s: %s"
> --
> 915-#: error.c:310
> 916-#, c-format
> 917:msgid "DEBUG warning: "
>
> The coproc thing was the only warning message I could think of right off
> hand. Listed right after the blurb about arrays not being exportable in the
> BUGS section of the man page, actually.
>
> Dumb aside, but it maybe doesn't make sense to have ampersands listed
> after them in the output from jobs:
> $ jobs
> ...
> [14]   Running                 coproc cat_coproc_1 { cat; } &
> [15]   Running                 coproc cat_coproc_2 { cat; } &
> Since ampersands don't appear in their declarations.
>
> $ declare -ax export_array=( one two three four )
>
> $ declare -p export_array
> declare -ax export_array=([0]="one" [1]="two" [2]="three" [3]="four")
>
> It leaves the export attribute set on the array variable, as well. But
> indeed, my little test script did not have access to this variable.
>
> Zack
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]