Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Modifiers and parameter expansion?
- X-seq: zsh-users 28472
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: dominik.vogt@xxxxxx, zsh-users@xxxxxxx
- Subject: Re: Modifiers and parameter expansion?
- Date: Thu, 1 Dec 2022 17:34:18 -0800
- Archived-at: <https://zsh.org/users/28472>
- In-reply-to: <Y4lMMptVvkj62FF3@localhost>
- List-id: <zsh-users.zsh.org>
- References: <Y4kcyW/acG5cPz+o@localhost> <1dcdd69c-ce29-921f-f0f0-6862f68b62a6@gmx.com> <CAH+w=7amodhidc8i1MqPWkqhYv2PkN56WmZQ8e-g-GU6p3F6GA@mail.gmail.com> <Y4ktCdAPhIVR7bGk@localhost> <CAH+w=7b5rQNkfQcRb1zVDbD5CMn-8F67pGS9JvshqyRiFF6nXw@mail.gmail.com> <Y4lMMptVvkj62FF3@localhost>
On Thu, Dec 1, 2022 at 4:52 PM Dominik Vogt <dominik.vogt@xxxxxx> wrote:
>
> > > 7. Modifiers
>
> Okay. Why are "%" "%%" "#" "##" "/" "//" refered to in this
> section?
Because they happen to be interpreted at the same "step" as modifiers,
and the documentation grew organically?
> > In the Parameter Expansion section
> >
> > ${NAME}
>
> The braces are required unless(1) they are not(2) required
> unless(3) some option is not(4) present. Quadruple negative.
Not sure where you came up with that. The braces are required when
(A) or when (B) or when (C), except (D) when not (C).
(A) followed by something may be part of an identifier
(B) complicated forms
(C) KSH_ARRAYS
(D) colons after or other tokens before
> All I understand is that it's trial and error to figure out
> whether braces are required.
Nonsense.
> $ unsetopt KSH_ARRAYS
> $ echo ^a =ls
> $ echo ~a
No, that's completely irrelevant. The BRACES aren't required, but the
$ IS. The above is not parameter expansion.
NO_KSH_ARRAYS allows
$X[2]
$X:h
$^X
$=X
$~X
$#X
$+X
KSH_ARRAYS requires
${X[2]}
${X:h}
${^X}
${=X}
${~X}
${#X}
${+X}
> This section could be split in two, to improve readability:
Possibly, but that affects several of the following descriptions as well.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author