[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Feature Request: scanf-like parsing
From: |
Greg Wooledge |
Subject: |
Re: Feature Request: scanf-like parsing |
Date: |
Mon, 25 Jan 2021 11:59:58 -0500 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Mon, Jan 25, 2021 at 06:47:36PM +0200, Oğuz wrote:
> 25 Ocak 2021 Pazartesi tarihinde Chet Ramey <chet.ramey@case.edu> 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 wrong with it
> anymore.
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 result.
You'll want to use eval only when it's absolutely necessary, and only when
it's safe. If bash's @K feature is designed to be fed to eval, then we
can assume it's safe. It becomes one of the very small number of
green-lighted cases where eval is OK.
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.
- Re: Feature Request: scanf-like parsing, (continued)
- Re: Feature Request: scanf-like parsing, Chet Ramey, 2021/01/25
- Re: Feature Request: scanf-like parsing, Chet Ramey, 2021/01/25
- Re: Feature Request: scanf-like parsing, Alex fxmbsw7 Ratchev, 2021/01/25
- Re: Feature Request: scanf-like parsing, Chet Ramey, 2021/01/25
- Re: Feature Request: scanf-like parsing, Alex fxmbsw7 Ratchev, 2021/01/25
- Re: Feature Request: scanf-like parsing, Eli Schwartz, 2021/01/25
- Re: Feature Request: scanf-like parsing, Alex fxmbsw7 Ratchev, 2021/01/25
- Re: Feature Request: scanf-like parsing, Eli Schwartz, 2021/01/25
- Message not available
- Fwd: Feature Request: scanf-like parsing, Alex fxmbsw7 Ratchev, 2021/01/25
- Re: Feature Request: scanf-like parsing, Oğuz, 2021/01/25
- Re: Feature Request: scanf-like parsing,
Greg Wooledge <=
- Re: Feature Request: scanf-like parsing, Chet Ramey, 2021/01/25
- Re: Feature Request: scanf-like parsing, Daniel Colascione, 2021/01/25
- Re: Feature Request: scanf-like parsing, Chet Ramey, 2021/01/25
- Re: Feature Request: scanf-like parsing, Greg Wooledge, 2021/01/25
- Re: Feature Request: scanf-like parsing, Alex fxmbsw7 Ratchev, 2021/01/25
- Re: Feature Request: scanf-like parsing, Chet Ramey, 2021/01/25
- Re: Feature Request: scanf-like parsing, Oğuz, 2021/01/25
- Re: Feature Request: scanf-like parsing, Greg Wooledge, 2021/01/25
- Re: Feature Request: scanf-like parsing, Oğuz, 2021/01/25
- Re: Feature Request: scanf-like parsing, Alex fxmbsw7 Ratchev, 2021/01/25