zsh-workers
 help / color / mirror / code / Atom feed
From: Jim <linux.tech.guy@gmail.com>
To: devs <zsh-workers@zsh.org>
Subject: history expansion - modifiers :h and :t - questions
Date: Tue, 24 Oct 2023 14:23:07 -0500	[thread overview]
Message-ID: <CA+rB6GLfDhjcakJNN4ZTDPndbenyN+3GohP5gcdbw2oX9-x9cg@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1159 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2137 bytes --]

             reply	other threads:[~2023-10-24 19:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 19:23 Jim [this message]
2023-10-24 21:56 ` Bart Schaefer
2023-10-24 23:24   ` Jim
2023-10-31 19:21     ` Jim
2023-10-26  6:33   ` Stephane Chazelas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+rB6GLfDhjcakJNN4ZTDPndbenyN+3GohP5gcdbw2oX9-x9cg@mail.gmail.com \
    --to=linux.tech.guy@gmail.com \
    --cc=linuxtechguy@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).