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

history expansion - modifiers :h and :t - questions



Hi everyone,

Maybe this has been discussed before and I haven't found it.  If so, sorry for the noise.
The man page talks about using :h and I assume by extension :t, in parameter
substitution. If so I was wondering why "digits" doesn't support  a parameter for the
number(s) following :h or :t? This would be useful in scripting.

print ${DirPath:h$N}
                  ^ does not work                                                                                   
Error message:  "zsh: unrecognized modifier"

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? This isn't what
currently happens. Did I miss something in the man page or basics of zsh I don't
understand?

Thanks for listening.  Again, sorry if this is just noise.

Example of current output for :h and :t

TestPath=/dirlev2/dirlev3/dirlev4

:h  /dirlev2/dirlev3
:h0 /dirlev2/dirlev3                  0 and 1, not the same
:h1 /
:h2 /dirlev2
:h3 /dirlev2/dirlev3
:h4 /dirlev2/dirlev3/dirlev4

:t  dirlev4
:t0 dirlev4                       0 and 1, the same
:t1 dirlev4
:t2 dirlev3/dirlev4
:t3 dirlev2/dirlev3/dirlev4
:t4 /dirlev2/dirlev3/dirlev4

Regards,

Jim Murphy




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