Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: history expansion - modifiers :h and :t - questions
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}}
> I'm not sure if the following is an inconsistency or not. Man page for :t states that
> 0(zero) is treated the same as 1. Should this also apply to :h?
The documentation for :t is being a bit too literal. More accurate
would be to say that 0 is always the same as having no digit at all.
In the case of :t counting from right to left :1 is also the same as
no digit at all, but for :h counting from left to right that's not the
case.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author