Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[BUG] Condition in [[ doesn't fire, with "if" it fires
- X-seq: zsh-workers 40667
- From: Sebastian Gniazdowski <psprint3@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [BUG] Condition in [[ doesn't fire, with "if" it fires
- Date: Tue, 28 Feb 2017 03:11:29 -0800
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= mesmtp; bh=yMYPPZFDZyR72p6Spff0snP+Yx0=; b=TUi2uZifK9xewbIB6cSvR jJZpbh53HzYAW7Qo7snt5K3uJSouIvSDJJ7ayn3x5KrnAMAA+hHw/u5RR8Ywn1f6 G2wbU+sH99BsJ7ozQJfaI9T+ZCBsJRm0Uy+G3iJSf7Fz6Hg4WfcH1p5yu71w901J j9IBnC/B3iNdMZ7FpFfvwI=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=smtpout; bh=yMYPPZFDZyR72p6Spff0snP+Y x0=; b=c1lRIJr90eVkn48csMzJ1Ae4/RCg98s6SY70UcoiUnYfI7cvLTT2kq3rg Oe5C8cNpvJOXwpOswYyIuuh5KgmMmlbERNN+qj1U2t3B09oC2iGgttUQUPqwWtVo OZOh6p6vGZm5TvZN+ckDRiyC7El+F4/6hCHguqpY1f3sq4joiQ=
- 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
Hello,
I have in code:
echo "Non-bumped line[${ZUI[log_scroll]}]: $line" >> /tmp/reply
[[ "${ZUI[log_scroll]}" = "below" ]] && (( line ++ )) || (( line
= stborder ))
echo "Bumped line: $line" >> /tmp/reply
It doesn't "bump" in certain situation. However, if I change the
condition to:
if [[ "${ZUI[log_scroll]}" = "below" ]]; then
(( line ++ ))
else
(( line = stborder ))
fi
Then it works also in the certain situation. Changing "[[" to "[" (with
no "if") doesn't help. Logs from fault-behavior say:
Non-bumped line[below]: 0
Bumped line: 0
So, the condition should fire because of "[below]".
To reproduce: just checkout this branch "debug_zsh_execution":
https://github.com/psprint/zui/tree/debug_zsh_execution
source from zshrc: "source ~/path/zui/zui.plugin.zsh". Then press Ctrl-O
Ctrl-P. An UI will fire and that's all. Now just scroll step by step to
line before "Append third!", like here:
https://asciinema.org/a/1mlc4wnegc6zbrkafv6zudg9z
You will see log messages overwritten, i.e. no (( line ++ )). All other
steps were firing the condition. Checked zsh-5.0.0, zsh-4.3.17, it
behaves identically.
--
Sebastian Gniazdowski
psprint3@xxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author