Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Parameter + prompt expansion %D{%T.%.} parser issue
- X-seq: zsh-workers 38883
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Roland Eggner <edvz2@xxxxxxxxxxxxxxxxxx>, zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: Parameter + prompt expansion %D{%T.%.} parser issue
- Date: Tue, 19 Jul 2016 02:21:39 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=3/jT0pDvmSJ4M6EG8PxD9sUH+Z8P54OmO86X9D/onrQ=; b=hcdYx21yPKk0iaKdJW+4vP5Dc8KvxPsm1TjT651mZdN51x704edOJYmIuqbsc3OVMd xwJ20GCE2hXX+ThZ2Az3OPTiaOH27JPpNNvlJzRzMYMZwgaqudLx4fmu5xb2iVSwyCpS s9jMmbk35PVR461IgcTObjQrJJNUI+acz4+VQgvRUL3vA/exgzvU3+OXb6j69T4X2M05 UemgqwrkA83N5Mka8mC/0cdrm/UfZbN0g3+xSKxc+2MF59AmlwroUHDnCt6KhAtcuvek SkBdDaGPHQm/FUq/rcwIqG/4TAJ0tSg192x3K5rL1s+9fqklj4AKs2n72rOn7i0E9Xa1 Yuyg==
- In-reply-to: <20160718203149.GA11086@mobil.systemanalysen.net>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20160718203149.GA11086@mobil.systemanalysen.net>
On Mon, Jul 18, 2016 at 10:31 PM, Roland Eggner
<edvz2@xxxxxxxxxxxxxxxxxx> wrote:
> emulate -R zsh -c 'print -l ${(%):-%D{%T.%.} %~} "${(%):-%D{%T.%.} %~}" ${(%):-"%D{%T.%.} %~"}'
>
> Expected:
> 22:03:02.324 ~
> 22:03:02.324 ~
> 22:03:02.324 ~
>
> Observed:
> 22:03:02.324 ~
> 22:03:02.324 %~}
> 22:03:02.324 ~
>
>
> Note the trailing “%~}” in the 2nd line.
>
> ZSH_PATCHLEVEL=zsh-5.2-282-ga22f4ea
> uname -m -o
> x86_64 GNU/Linux
>
> Usage error? Bug? Feature?
Usage error, but it's kind of hard to understand what's going on there
admittedly. When ${} is unquoted, then the parser "knows" which {}
belong together, but when you have them under double quotes the {} for
the %D are not special in any way, so the terminating } for %D matches
the ${ as well. You need "${(%):-%D{%T.%.\} %~}" (It would also be a
good idea to use -r for print when testing quoting things although in
this case it makes no difference.)
The same thing happens when you use %F{} etc.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author