Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
parameter expansion with '$'
- X-seq: zsh-users 19923
- From: Kartik Agaram <ak@xxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: parameter expansion with '$'
- Date: Wed, 25 Feb 2015 12:50:16 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:message-id:subject:to:content-type; bh=2badqR/0gNvvG+gxB+bhwIbgL4atKFTI4/2SQdUBq3E=; b=wR/S/ODwS7K055TgOD6mNNa7xM9doqIcuXP3ANvt6w0vgaJsoHIusUw1KMGFFOteW7 ETl4lregMfrxII0VwTrEOiCr9tiBNBJtuia7xx6NtGTExjwG397vjfXjK+/TYDBD9Ktn QDGyRbvjSP/wf4lXEI7aduOUwiOZZc68NL5gWdCcJI0acuvQhS1E48rM4c4H3mlVTNIc ucBLmUJOM4DKHUAYmmjcyvf+kqPcXLKF82ntWgVSDHtEm/WWMwtKtUK3Td+ZXKWqMtCR OqYiF2lgRF2a+OG1b3ybsaNWNconpYtpKs8mLVUC25JpS7Q9TorSR5reqoyhJt+Y/ptM 1v1Q==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Sender: akkartik@xxxxxxxxx
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author