[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: extglob and ()/{}
From: |
Peng Yu |
Subject: |
Re: extglob and ()/{} |
Date: |
Tue, 6 Apr 2021 09:56:06 -0500 |
On Mon, Apr 5, 2021 at 8:23 PM Marco Ippolito <maroloccio@gmail.com> wrote:
>
> Greg said it all:
>
> > extglob changes the way certain characters are parsed. It is necessary to
> > have a newline (not just a semicolon) between shopt -s extglob and any
> > subsequent commands to use it. You cannot enable extended globs inside a
> > group command that uses them, because the entire block is parsed before the
> > shopt is evaluated.
So the bottomline is not to use `shopt -s extglob` in () and {}
blocks? If one wants to use `shopt -s extglob`, it must be outside of
() and {} blocks?
> > Note that the typical function body is a group command.
> > An unpleasant workaround could be to use a subshell command list as the
> > function body.
--
Regards,
Peng