Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Baffling bug with ${(S)...} or ${...//p/r} and math context
- X-seq: zsh-workers 13943
- From: Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx (Zsh hackers list)
- Subject: Re: Baffling bug with ${(S)...} or ${...//p/r} and math context
- Date: Wed, 11 Apr 2001 01:04:13 +0100
- In-reply-to: ""Bart Schaefer""'s message of "Mon, 02 Apr 2001 04:41:19 -0000." <1010402044119.ZM14251@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
"Bart Schaefer" wrote:
> Now here's the strange bit: If I use that in a math expression (( ... )),
> it gives the correct number, and the inequality evaluates correctly:
>
> ((${#${(f)${(%%)${(S)PS1//[%]\{*%\}/}}}[1]} > COLUMNS-2))
>
> However, if I immediately evaluate the same expression again, the answer
> is different! E.g., if I do
>
> print ${#${(f)${(%%)${(S)PS1//[%]\{*%\}/}}}[1]}
> ((${#${(f)${(%%)${(S)PS1//[%]\{*%\}/}}}[1]} > COLUMNS-2))
> print ${#${(f)${(%%)${(S)PS1//[%]\{*%\}/}}}[1]}
>
> I'm likely to get
>
> 77
> 86
>
> as the output.
Hmm, it wouldn't be something to do with the fact that the length of the
output, even excluding %{...%}'s, varies with the status of the previous
command, by any chance?
--
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
Work: pws@xxxxxxx
Web: http://www.pwstephenson.fsnet.co.uk
Messages sorted by:
Reverse Date,
Date,
Thread,
Author