Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: history expansion - modifiers :h and :t - questions



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