Re: Feature Request: scanf-like parsing

2021-01-25 Thread pepa65
On 1/26/21 2:46 AM, Chet Ramey wrote: > On 1/25/21 12:58 PM, Oğuz wrote: >> I rarely use eval, but when I do, it works just fine. > > Someone should create a meme with this text superimposed on an image of the > Dos Equis most interesting man in the world. Not sure whether attachments are allowe

Re: . and .. are included where they were excluded before

2021-01-25 Thread
On 25/01/2021 21:36, gregrwm wrote: Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-a6qmCk/bash-5.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wno-pare

Re: . and .. are included where they were excluded before

2021-01-25 Thread gregrwm
sorry, typo: and in the more recent versions it's a different inconsistency, . is excluded from ? ?? but included in @(?|.?) should be: and in the more recent versions it's a different inconsistency, . is excluded from ? .? but included in @(?|.?) tho as i said that's a tad askew from... On Mon

. and .. are included where they were excluded before

2021-01-25 Thread gregrwm
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-a6qmCk/bash-5.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wno-parentheses -Wno-format-security uname out

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Chet Ramey
On 1/25/21 2:51 PM, Greg Wooledge wrote: On Mon, Jan 25, 2021 at 02:46:24PM -0500, Chet Ramey wrote: On 1/25/21 12:58 PM, Oğuz wrote: I rarely use eval, but when I do, it works just fine. Someone should create a meme with this text superimposed on an image of the Dos Equis most interesting m

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Greg Wooledge
On Mon, Jan 25, 2021 at 02:46:24PM -0500, Chet Ramey wrote: > On 1/25/21 12:58 PM, Oğuz wrote: > > > I rarely use eval, but when I do, it works just fine. > > Someone should create a meme with this text superimposed on an image of the > Dos Equis most interesting man in the world. https://imgfli

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Chet Ramey
On 1/25/21 12:58 PM, Oğuz wrote: I rarely use eval, but when I do, it works just fine. Someone should create a meme with this text superimposed on an image of the Dos Equis most interesting man in the world. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ar

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Chet Ramey
On 1/25/21 12:53 PM, Greg Wooledge wrote: On Mon, Jan 25, 2021 at 12:13:25PM -0500, Chet Ramey wrote: This is good advice. If the double-quoting the @K transformation performs is not what you need, use the @Q transformation to get something closer. Those don't do the same thing, though. Yes,

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Léa Gris
Le 25/01/2021 à 18:58, Oğuz écrivait : I rarely use eval, but when I do, it works just fine. I can't really agree with the sentiment of your article, sorry. I use eval when I am sure there is no other safer way. Mean, if I can achieve the same with declare foo="dynamically generated content"

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Alex fxmbsw7 Ratchev
word, hopefully ppl migrate to such as 'use what a tool supports' On Mon, Jan 25, 2021, 19:22 Oğuz wrote: > On Mon, Jan 25, 2021 at 9:15 PM Greg Wooledge wrote: > > > Again, there are many different authors of that page. Think of it as > > a community FAQ, rather than mine. It was written by

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Oğuz
On Mon, Jan 25, 2021 at 9:15 PM Greg Wooledge wrote: > Again, there are many different authors of that page. Think of it as > a community FAQ, rather than mine. It was written by a committee, as > horrifying as that may sound. > Okay, I'm not saying I know better than the members of that ``com

Fwd: Feature Request: scanf-like parsing

2021-01-25 Thread Alex fxmbsw7 Ratchev
-- Forwarded message - From: Alex fxmbsw7 Ratchev Date: Mon, Jan 25, 2021, 19:14 Subject: Re: Feature Request: scanf-like parsing To: Eli Schwartz On Mon, Jan 25, 2021, 18:58 Eli Schwartz wrote: > On 1/25/21 12:48 PM, Alex fxmbsw7 Ratchev wrote: > > you havent been on #bash

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Greg Wooledge
On Mon, Jan 25, 2021 at 08:58:23PM +0300, Oğuz wrote: > This sentence alone reflects that article's perspective on the issue. > > "eval" is a common misspelling of "evil". > > I rarely use eval, but when I do, it works just fine. I can't really agree > with the sentiment of your article, sorry. A

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Alex fxmbsw7 Ratchev
assoc copy without eval root@localhost:~# unset orig copy root@localhost:~# declare -A orig=( [a\ key]=a\ value [another\ key]=another\ value ) ; rep=$( declare -p orig ) root@localhost:~# rep=$( declare -p orig ) root@localhost:~# declare -A "copy=${rep#*=}" root@localhost:~# declare -p copy de

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Oğuz
On Mon, Jan 25, 2021 at 8:06 PM Greg Wooledge wrote: > It's a tricky thing to deal with. Eli referenced my wiki, which has a > page dedicated to it, with contributions from many different authors. > The resulting quasi-consensus is complex and perhaps even a little > bit self-contradictory as a

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Eli Schwartz
On 1/25/21 12:48 PM, Alex fxmbsw7 Ratchev wrote: you havent been on #bash freenode irc where it is the reverse to this quote 'no one ..', where also 'bash is no coding language' and x other invalid things are common, to all i disagree, but the masses of ignorant wrong teachen ppl overwealth me an

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Greg Wooledge
On Mon, Jan 25, 2021 at 12:13:25PM -0500, Chet Ramey wrote: > This is good advice. If the double-quoting the @K transformation performs > is not what you need, use the @Q transformation to get something closer. Those don't do the same thing, though. unicorn:~$ declare -A aa=([a key]="a value" [$'

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Alex fxmbsw7 Ratchev
On Mon, Jan 25, 2021, 17:50 Eli Schwartz wrote: > On 1/25/21 11:28 AM, Alex fxmbsw7 Ratchev wrote: > > cool, now that u're the main bash coder greycat and co wont fall like > > cannibals over you for using eval > > cheers for old code > > No one ever said eval is evil, if you're using it solely t

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Chet Ramey
On 1/25/21 11:59 AM, Greg Wooledge wrote: The problem with eval is that for every OK usage, there are a thousand incorrect and dangerous uses. Avoid those, by being absolutely sure you know what you're doing, and why you're doing it. The shell is a sharp tool. -- ``The lyf so short, the craf

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Chet Ramey
On 1/25/21 11:59 AM, Greg Wooledge wrote: The problem with eval is that for every OK usage, there are a thousand incorrect and dangerous uses. Avoid those, by being absolutely sure you know what you're doing, and why you're doing it. This is good advice. If the double-quoting the @K transform

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Daniel Colascione
On 1/25/21 11:59 AM, Greg Wooledge wrote: On Mon, Jan 25, 2021 at 06:47:36PM +0200, Oğuz wrote: 25 Ocak 2021 Pazartesi tarihinde Chet Ramey yazdı: declare -A copy eval copy=( "${assoc[@]@K}" ) So many reputable people contributed to the demonization of `eval' that I don't think I can convinc

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Greg Wooledge
On Mon, Jan 25, 2021 at 06:47:36PM +0200, Oğuz wrote: > 25 Ocak 2021 Pazartesi tarihinde Chet Ramey yazdı: > > declare -A copy > > eval copy=( "${assoc[@]@K}" ) > > So many reputable people contributed to the demonization of `eval' that I > don't think I can convince anyone that there's nothing w

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Eli Schwartz
On 1/25/21 11:28 AM, Alex fxmbsw7 Ratchev wrote: cool, now that u're the main bash coder greycat and co wont fall like cannibals over you for using eval cheers for old code No one ever said eval is evil, if you're using it solely to consume the output of a shell builtin functionality specifica

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Oğuz
25 Ocak 2021 Pazartesi tarihinde Chet Ramey yazdı: > > There has been code to do this for a long time. It's currently tagged for > bash-5.2. If you want to play around with it, look in subst.c for > shouldexp_replacement and its caller, and uncomment them. You'll have to > wait for the next devel

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Alex fxmbsw7 Ratchev
i completly agree, .. just dunno why others dont :) On Mon, Jan 25, 2021, 17:31 Chet Ramey wrote: > On 1/25/21 11:28 AM, Alex fxmbsw7 Ratchev wrote: > > cool, now that u're the main bash coder greycat and co wont fall like > > cannibals over you for using eval > > cheers for old code > > The she

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Chet Ramey
On 1/25/21 11:28 AM, Alex fxmbsw7 Ratchev wrote: cool, now that u're the main bash coder greycat and co wont fall like cannibals over you for using eval cheers for old code The shell is a sharp tool. If you're going to use it to try and cut your fingers off, it's not going to stop you. If you

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Alex fxmbsw7 Ratchev
cool, now that u're the main bash coder greycat and co wont fall like cannibals over you for using eval cheers for old code On Mon, Jan 25, 2021, 17:18 Chet Ramey wrote: > On 1/25/21 10:17 AM, Chet Ramey wrote: > > I agree that it might be more useful if it > > expanded to multiple words in cont

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Chet Ramey
On 1/25/21 10:17 AM, Chet Ramey wrote: I agree that it might be more useful if it expanded to multiple words in contexts like copy=( "${assoc[@]@K}" ) I forgot to mention that since the keys and values are both quoted so they can be reused, you can copy an associative array using a key-value a

Re: Feature Request: scanf-like parsing

2021-01-25 Thread Chet Ramey
On 1/22/21 11:54 AM, Oğuz wrote: Since everyone's making feature requests here, it'd be a shame if I didn't participate. I think it'd be better if `${assoc[@]@K}' expanded to a word list instead of a single word. It does, when it's subject to word splitting. In contexts where no word splittin