Re: [PATCH] printf: add %#s alias to %b

2023-09-05 Thread Robert Elz
Date:Wed, 6 Sep 2023 08:13:23 +0300 From:=?UTF-8?B?T8SfdXo=?= Message-ID: | What's the point? Does anyone need this feature in their shell scripts (and | can't afford to use bc for it)? Adding a different %b to printf(1) wasn't currently even proposed, just dep

Re: [PATCH] printf: add %#s alias to %b

2023-09-05 Thread Robert Elz
Date:Tue, 05 Sep 2023 22:32:39 +0200 From:Dragan Simic Message-ID: <7cfed11b50d35cbfaaa647c1fcd39...@manjaro.org> | Are there any official explanations why is the invalidation actually | happening now? It was proposed because of a desire to keep the formats for

Re: [PATCH] printf: add %#s alias to %b

2023-09-05 Thread Oğuz
On Tuesday, September 5, 2023, Chet Ramey wrote: > to print binary literals > What's the point? Does anyone need this feature in their shell scripts (and can't afford to use bc for it)? -- Oğuz

Re: [PATCH] printf: add %#s alias to %b

2023-09-05 Thread Rob Landley
On 9/5/23 15:44, Chet Ramey wrote: > On 9/5/23 4:32 PM, Dragan Simic wrote: >> On 2023-09-05 22:25, Chet Ramey wrote: >>> On 9/5/23 3:58 PM, enh wrote: On Fri, Sep 1, 2023 at 6:59 AM Chet Ramey wrote: >>> > I think you'll find that, regardless of its origins, there are more > scripts

Re: [PATCH] printf: add %#s alias to %b

2023-09-05 Thread enh
On Tue, Sep 5, 2023 at 4:31 PM Rob Landley wrote: > > On 9/5/23 15:44, Chet Ramey wrote: > > On 9/5/23 4:32 PM, Dragan Simic wrote: > >> On 2023-09-05 22:25, Chet Ramey wrote: > >>> On 9/5/23 3:58 PM, enh wrote: > On Fri, Sep 1, 2023 at 6:59 AM Chet Ramey wrote: > >>> > > I think you'll

Parse error in bash 5.2+ with CHLD trap and 2 or more $() in a command

2023-09-05 Thread Emanuele Torre
If you have a CHLD trap set, and you run any command that has more than one command substitution, or an array subscript with more than one command substituion in an arithmetic context, or also in a prompt string, you will get parse errors. $ ./bash -c 'trap : CHLD; let "x[\$(exit 20)0]"' $ ./

Re: [PATCH] printf: add %#s alias to %b

2023-09-05 Thread Dragan Simic
On 2023-09-05 22:25, Chet Ramey wrote: On 9/5/23 3:58 PM, enh wrote: On Fri, Sep 1, 2023 at 6:59 AM Chet Ramey wrote: I think you'll find that, regardless of its origins, there are more scripts using the %b specifier than you think. i'd personally never heard of printf(1) %b before this t

Re: [PATCH] printf: add %#s alias to %b

2023-09-05 Thread Chet Ramey
On 9/5/23 4:32 PM, Dragan Simic wrote: On 2023-09-05 22:25, Chet Ramey wrote: On 9/5/23 3:58 PM, enh wrote: On Fri, Sep 1, 2023 at 6:59 AM Chet Ramey wrote: I think you'll find that, regardless of its origins, there are more scripts using the %b specifier than you think. i'd personally n

Re: Warn upon "declare -ax"

2023-09-05 Thread Martin D Kealey
On Wed, 6 Sep 2023, 01:46 Kerin Millar, wrote: > My pet name for it is arrayshock. > > $ arr=(foo bar baz) > $ export arr > $ env | grep ^BASH_ARRAY_ > BASH_ARRAY_arr%%=([0]="foo" [1]="bar" [2]="baz") > $ ./bash -c 'declare -p arr' > declare -ax arr=([0]="foo" [1]="bar" [2]="baz") > I've often w

Re: [PATCH] printf: add %#s alias to %b

2023-09-05 Thread Chet Ramey
On 9/5/23 3:58 PM, enh wrote: On Fri, Sep 1, 2023 at 6:59 AM Chet Ramey wrote: I think you'll find that, regardless of its origins, there are more scripts using the %b specifier than you think. i'd personally never heard of printf(1) %b before this thread, but debian code search agrees with

Re: [PATCH] printf: add %#s alias to %b

2023-09-05 Thread enh
On Fri, Sep 1, 2023 at 6:59 AM Chet Ramey wrote: > > On 8/31/23 5:15 PM, Eric Blake wrote: > > > > It's not hard to see why POSIX is choosing to have Issue 8 obsoleting > > (not removing) %b's old semantics; in the short term, nothing about %b > > changes, so your dusty-deck shell scripts will con

Re: set -x vs. n=($@)

2023-09-05 Thread Chet Ramey
On 9/3/23 6:08 AM, Dan Jacobson wrote: It's not fair: set -x a b c m=$@ n=($@) == gives == + m='a b c' + n=($@) It's because the compound assignment forces the expansion to be deferred. You have to figure out what kind of array you're dealing with, for example, and what kind of compound assignm

Re: set -x vs. n=($@)

2023-09-05 Thread Chet Ramey
On 9/3/23 12:15 PM, Lawrence Velázquez wrote: However... bash-5.2$ declare -a c=("$a") + c=('foo') + declare -a c You kind of have to. This isn't an assignment statement, since `declare' is a builtin and its arguments have to be expanded before it's called and set -x k

Re: Inner Command Lists fail in Bash 5.2.15

2023-09-05 Thread Chet Ramey
On 9/1/23 1:28 PM, Kerin Millar wrote: On Fri, 1 Sep 2023 12:52:14 -0400 Dima Korobskiy wrote: Kerin, thanks for the workaround. Just to clarify, is the issue specific to the `time` command? I think that you would have to get an answer from Chet because yacc/bison grammar is a little over

Re: Allow `read` to recognize custom completions

2023-09-05 Thread Chet Ramey
On 9/2/23 11:33 AM, konsolebox wrote: On Mon, Jun 21, 2021 at 11:34 PM Chet Ramey wrote: I'll consider it. It's low priority right now. Hello Chet, I just saw this implemented in 5.3. Just want to say thanks a lot!! I extremely appreciate it. Credit where credit's due: - read_bui

Re: give_terminal_to() / maybe_give_terminal_to() race

2023-09-05 Thread Chet Ramey
On 9/2/23 12:40 PM, Earl Chew wrote: On 2023-09-01 09:07, Chet Ramey wrote: On 9/1/23 11:48 AM, Earl Chew wrote: What remains might be whether there is value in maintaining the present barrier in both parent and child so that it is straightforward to reason about designation of the foreground

Re: Warn upon "declare -ax"

2023-09-05 Thread Kerin Millar
On Tue, 5 Sep 2023 16:04:50 +0200 alex xmb ratchev wrote: > On Mon, Sep 4, 2023, 15:19 Kerin Millar wrote: > > > On Mon, 4 Sep 2023 14:46:08 +0200 > > Léa Gris wrote: > > > > > Le 04/09/2023 à 14:18, Dan Jacobson écrivait : > > > > Shouldn't "declare -ax" print a warning that it is useless? >

Re: Warn upon "declare -ax"

2023-09-05 Thread Greg Wooledge
On Tue, Sep 05, 2023 at 05:09:52PM +0200, Andreas Kähäri wrote: > On Tue, Sep 05, 2023 at 04:04:50PM +0200, alex xmb ratchev wrote: > > On Mon, Sep 4, 2023, 15:19 Kerin Millar wrote: > > > Curiously, ARRAY_EXPORT can be defined in config-top.h. It's probably safe > > > to say that nobody uses it (

Re: Warn upon "declare -ax"

2023-09-05 Thread Andreas Kähäri
On Tue, Sep 05, 2023 at 04:04:50PM +0200, alex xmb ratchev wrote: > On Mon, Sep 4, 2023, 15:19 Kerin Millar wrote: > > > On Mon, 4 Sep 2023 14:46:08 +0200 > > Léa Gris wrote: > > > > > Le 04/09/2023 à 14:18, Dan Jacobson écrivait : > > > > Shouldn't "declare -ax" print a warning that it is usele

Re: Warn upon "declare -ax"

2023-09-05 Thread alex xmb ratchev
On Mon, Sep 4, 2023, 15:19 Kerin Millar wrote: > On Mon, 4 Sep 2023 14:46:08 +0200 > Léa Gris wrote: > > > Le 04/09/2023 à 14:18, Dan Jacobson écrivait : > > > Shouldn't "declare -ax" print a warning that it is useless? > > > > There don's seem to be any warning system in Bash or other shells. A

Re: Warn upon "declare -ax"

2023-09-05 Thread Zachary Santer
Woops. On Mon, Sep 4, 2023 at 10:16 PM Zachary Santer wrote: > On Mon, Sep 4, 2023 at 8:46 AM Léa Gris 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 ca