zsh-users
 help / color / mirror / code / Atom feed
From: Kartik Agaram <ak@akkartik.com>
To: zsh-users@zsh.org
Subject: parameter expansion with '$'
Date: Wed, 25 Feb 2015 12:50:16 -0800	[thread overview]
Message-ID: <CANOtCLVAzdZacxtJps4YEyGGzq5AWfSxXzhQ+TiS-oTOnOMPTw@mail.gmail.com> (raw)

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

Hi,

Consider this example:

$ X=abc
$ echo ${X/c/}
ab

However, I'd like to only perform the substitution when 'c' occurs at the
end of the string:

$ echo ${X/c$/}
abc  # I'd like this to return 'ab' like above

I assume others see the same results? Can anybody help me understand why it
doesn't work, and how I can interpret the '$' as a regular expression
wildcard rather than some other sort of zsh sigil?

Thanks,
Kartik
zsh 5.0.5 on x86_64 with extendedglob

             reply	other threads:[~2015-02-25 20:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-25 20:50 Kartik Agaram [this message]
2015-02-25 21:18 ` Roman Neuhauser
2015-02-25 21:20   ` Kartik Agaram

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=CANOtCLVAzdZacxtJps4YEyGGzq5AWfSxXzhQ+TiS-oTOnOMPTw@mail.gmail.com \
    --to=ak@akkartik.com \
    --cc=zsh-users@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).