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

Re: "history" modifier question



On Wed, May 3, 2023 at 11:32 PM Jim <linux.tech.guy@xxxxxxxxx> wrote:
>
> Trying to use history modifier 'h [ digit ]' (the following also applies to
> 't [digit ]'),where digit is a scalar or integer, ( e.g. ${PWD:h${N}} )

You can do it like this:  ${(e):-\${PWD:h${N}}}

> I would like to understand what I'm missing here. The man
> page, AFAICT, doesn't say  one way or the other if this is possible. Unless,
> "digit" is explicit here.

Yes, the digit following :h has to be a literal digit, not an expansion.




Messages sorted by: Reverse Date, Date, Thread, Author