Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
History expansion modifiers :t, :h, :r and :e break quoting in some cases
- X-seq: zsh-workers 31501
- From: Axel Beckert <abe@xxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: History expansion modifiers :t, :h, :r and :e break quoting in some cases
- Date: Tue, 2 Jul 2013 19:43:56 +0200
- Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAAAAAC3mUtaAAAABGdBTUEAALGPC/xhBQAAADh0RVh0U29mdHdhcmUAWFYgVmVyc2lvbiAzLjEwYSAgUmV2OiAxMi8yOS85NCAoUE5HIHBhdGNoIDEuMindFS5JAAACGElEQVQ4jXXQMU8UYRDG8f8shNjdDH4AbpfGDjAWlKiJiZ0ajL1aGCvsNCbGaCGG1koLaztaTYz6ATy+gOyehYmF3MxVxgg3FnDsHcTpJr/M+8w7Rf6nCsaVTTDqxbg9hoOXmw83H71+Eyfg4E1d7/Z2fG9rGkZbTQiu+K+3U/C+76lmkvAhJuDndnoAiftou4V84okAGclop4U/jYACZDTxrYWP0gkxVfAm/W//GLZpxIzwIN0Hn8dw0B+IWkZmQmRsj2HfhwokEklHfNCCiQCRgAR7YyhQVRVTCKCzP4Y5zBBE0t0zY3Q8oQaBqqAMlVEcgVQd9706zGirAFium8HXumlMIeMwqQCInju+2+uB6MRENupdpMt8pRlHZyuAW0F+Mb6XSIVqtxjD+iVmVqqystLEzFTGT92YqRaXpNT5eTVjeJhbALPnrTxLUZUKZsgxcNm64hAOYisT/xhF+oKTGU5RegtC3Rt6eEDi/QnIevdTx9Md2EMmYBRmCQR1026FCGQQJJExsRUqgkMGaWSbwYLnoO4T6VgpbQbdELPMBAHWWrhYrcxXnYgAsatPWygkFCBD4K62MAsOTqA6szYRPpsu6e6Y8mPiVrBMNuGIMrgwBUu4p2DgG1Ownu6hpuTv7hScefHAzAC/yRRw5U5pALMbJ4AUALvHSZhxgHPXTsHcdWD1GadAHr9avP+c0wCr7263Df8ASLwXWHWs+KIAAAAHdElNRQfYBQEBODPr
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Organization: DeuxChevaux.org -- The Citroën 2CV Database
Hi,
Today I was slightly confused about the "`quote>" prompt after the
following commands:
% echo 'foo/bar'
foo/bar
% echo !$:h
`quote> ^C
echo 'foo
%
(I manually added the "^C" above where I pressed Ctrl-C. My real-life
case was more complex and had blanks in the file names and hence
qualifies the quoting. :-)
So ":h" seems not only to strip "/bar" as I would have expected but
also strips the trailing single quote.
The same happens with ":e" as well as with ":t" or ":r" and the
leading single quote:
% echo 'foo/bar.bla'
foo/bar.bla
echo !$:e
`quote> ^C
echo bla'
%
% echo 'foo/bar'
foo/bar
% echo !$:t
`quote> ^C
echo bar'
%
% echo 'foo/bar.bla'
foo/bar.bla
% echo !$:r
`quote> ^C
echo 'foo/bar
%
It also behaves the same way with double quotes instead of single
quotes.
At least for enclosing double and single quotes, I would have expected
that these are not stripped on :t or :h. I can imagine that it may be
harder to implement for more complex quoting variants like
% echo "foo '"'/"'"' bla"
foo '/"' bla
%
Initially noticed with zsh 4.3.17 in Debian Wheezy, but also
reproducible with zsh 5.0.2 in Debian Unstable.
Kind regards, Axel
--
/~\ Plain Text Ribbon Campaign | Axel Beckert
\ / Say No to HTML in E-Mail and News | abe@xxxxxxxxxxxxxxx (Mail)
X See http://www.asciiribbon.org/ | abe@xxxxxxxxx (Mail+Jabber)
/ \ I love long mails: http://email.is-not-s.ms/ | http://noone.org/abe/ (Web)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author