Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: history expansion - modifiers :h and :t - questions
- X-seq: zsh-workers 52245
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: linuxtechguy@xxxxxxxxx, devs <zsh-workers@xxxxxxx>
- Subject: Re: history expansion - modifiers :h and :t - questions
- Date: Thu, 26 Oct 2023 07:33:38 +0100
- Archived-at: <https://zsh.org/workers/52245>
- In-reply-to: <CAH+w=7abgtoie5hkC5Be1yqxhAsR+qA3eMPFxEjaVNHq9=tnaA@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, linuxtechguy@xxxxxxxxx, devs <zsh-workers@xxxxxxx>
- References: <CA+rB6GLfDhjcakJNN4ZTDPndbenyN+3GohP5gcdbw2oX9-x9cg@mail.gmail.com> <CAH+w=7abgtoie5hkC5Be1yqxhAsR+qA3eMPFxEjaVNHq9=tnaA@mail.gmail.com>
2023-10-24 14:56:39 -0700, Bart Schaefer:
> On Tue, Oct 24, 2023 at 12:23 PM Jim <linux.tech.guy@xxxxxxxxx> wrote:
> >
> > print ${DirPath:h$N}
> > ^ does not work
> > Error message: "zsh: unrecognized modifier"
>
> Yes ... "$" is not a digit. Parameters are not expanded here.
>
> You can get around this with ${(e):-\${DirPath:h$N}}
[...]
For existing $DirPath's, see also:
print -r -- $DirPath(N:h$N)
as parameters are expanded in glob qualifiers.
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author