help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Why `echo !(*.l).c` behaves different depending on the c


From: Peng Yu
Subject: Re: [Help-bash] Why `echo !(*.l).c` behaves different depending on the context?
Date: Tue, 12 Feb 2019 22:25:00 -0600

On Mon, Feb 11, 2019 at 11:02 AM Chet Ramey <address@hidden> wrote:
>
> On 2/11/19 11:57 AM, Peng Yu wrote:
> >> This makes no sense at all. Whether or not the shell parses each command
> >> in, say, the body of a compound command one at a time (it does, but they
> >> are all part of the same command list), it cannot execute any of them until
> >> the entire compound command is parsed successfully. Would you want the
> >> test in an if statement to be executed, and commands executed on the fly
> >> as they are encountered, without a trailing `fi'?
> >
> > Then, you can make it fail (and possibly roll back before the
> > if-statement). I don't think it is absolutely impossible to do. It is
> > just probably difficult to do with the current framework.
>
> `Rolling back' the execution of arbitrary commands is not possible. That's
> not going to work the way you think it might.

Then just define the behavior to not roll back. But one can still
execute the commands one by one instead of as a whole. After all, a
regular list of commands is executed one by one. One should be able to
run the commands in an if-statement one by one and allowing it to fail
in between.

-- 
Regards,
Peng



reply via email to

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