[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in syntax checking causes unintended running of a function
From: |
konsolebox |
Subject: |
Re: Bug in syntax checking causes unintended running of a function |
Date: |
Wed, 20 Apr 2016 15:55:11 +0800 |
On Tue, Apr 19, 2016 at 10:45 PM, David Maas <david.maas@gmail.com> wrote:
> Running the echo and other contents of the function really doesn't seem like
> the correct behavior. If the function isn't called, then its contents
> shouldn't be executed.
Choose: Should the shell stop execution or not? Can you give a theory how a
shell can make sure that an ending brace is the real ending brace of a function
when a syntax error happens? (In all possible cases.)
> Hypothetically, what if the author was partway through writing a backup
> script that removes backed up data? The behavior of bash in this instance
> could cause a serious problem.
That's bad scripting practice IMO. You don't test script you just wrote with
real data. Syntax errors only happen once, unless you don't fix them right
away, or if you don't know how to use `eval` when you _have_ to use it.
(Please avoid quoting this obvious thing about `eval` again.)
- Bug in syntax checking causes unintended running of a function, David Maas, 2016/04/18
- Re: Bug in syntax checking causes unintended running of a function, konsolebox, 2016/04/18
- Bug in syntax checking causes unintended running of a function, David Maas, 2016/04/19
- Re: Bug in syntax checking causes unintended running of a function, Chet Ramey, 2016/04/19
- Re: Bug in syntax checking causes unintended running of a function,
konsolebox <=
- Re: Bug in syntax checking causes unintended running of a function, David Maas, 2016/04/20
- Re: Bug in syntax checking causes unintended running of a function, Greg Wooledge, 2016/04/20
- Re: Bug in syntax checking causes unintended running of a function, David Maas, 2016/04/20
- Re: Bug in syntax checking causes unintended running of a function, David Maas, 2016/04/20
- Re: Bug in syntax checking causes unintended running of a function, Chet Ramey, 2016/04/20
Re: Bug in syntax checking causes unintended running of a function, Chet Ramey, 2016/04/19
RE: Bug in syntax checking causes unintended running of a function, dnade.ext, 2016/04/21