From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HTML_MESSAGE,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 14869 invoked from network); 23 May 2022 16:56:33 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 23 May 2022 16:56:33 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1653324993; b=jB9sTVE7nKkpfU3X280/XrZCxxw+Die5IydHxbF04syTaPwOF9FmNeJnl3pVMQ0yI4YscN/v1t zBeDHaCudIb0wqKsR4AfEXqd2cojc04Ll8jl/lBbmfea4t51jNw02RGnwBmQa1CGbhnnP+EX89 WsgNAnLk3B/cp7IEdMeze7002wyx3x+ifaZl+C232yzLl23DzmlNhnD2uHboUaBBd3HTKshs04 qvXEsYDTIYgxtSimAVIRqtDiTarqEx4bpK8/w4Jo7HvI9On4ThSL24X9wTAbFPGMwQqenE2/nF dEJO/Defk/rV9WRsClZHkCT+Eehfm44lhKwoKn0PSS5rDg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta-p5.oit.umn.edu) smtp.remote-ip=134.84.196.205; dkim=pass header.d=d.umn.edu header.s=google header.a=rsa-sha256; dmarc=pass header.from=d.umn.edu; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1653324993; bh=NlQwaLT21pdZYiO4Q5lUf4I+RjlVpn6QNphpWW/B9jk=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=lciKZYXhSD18bOJrfQvv6Q546p/lP/mJTAJUsEECbf7lS78UBZZiah7t7qE7qTafrX3JexNeA3 d9ITzqrhLnMkanF2A+QMH05B0raHugBKfvHFKbMCIqEfCaBZdFbiqrh8/vEC9x6PMvVk8HuLHl eh7Iw9BY8Cw+729/X+NOfl2DktXxGblAm8pJ/192G5jJhgSdUKhAO9oY9rjcH7G3quD3uR+yyg E1fkKRJx8aJmfjv39cBPgoDCJosgG37L2sR3s0Sjv2+XxJU8crXI1gMqRvVREt6i8yiDIXXwhX a/77Szpf1hn/pqWs2yY88wylgofDbxESpHHrYoOo1R2Bzw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=NlQwaLT21pdZYiO4Q5lUf4I+RjlVpn6QNphpWW/B9jk=; b=U4ev/++YJxpE9zyUtQxOsrL7CF mNXs1vTYxmjBTGcifM8Zj3IcilTnSX6jpZ43GmkJ7RG5EMl6c62XHKFMRoXZDh7Ndsttd4EjQeRWm Hr6b5nM9M8ckMAyqrOzTt/UlOufqOtwdpkl9GtS6ACIWp/vDOhnL8k7YZe8wdZeiPxbx3P57XGB5J zYLEi+qa0l0TdBUyJV79X0DOg3HzcP1LkyrDXE2XC4is+fvBhNQejsHyxP+qtJLPLLTb2I5e7L9yA I7qEknuImn644x0HVbTC3+kkMhuR9it3ZmDWmikamWQM4wYC2FnmHXihiV+qKiA7KeJ7KAGCb9DiA 6tiXYbwg==; Received: from authenticated user by zero.zsh.org with local id 1ntBM7-0005WV-Ek; Mon, 23 May 2022 16:56:31 +0000 Authentication-Results: zsh.org; iprev=pass (mta-p5.oit.umn.edu) smtp.remote-ip=134.84.196.205; dkim=pass header.d=d.umn.edu header.s=google header.a=rsa-sha256; dmarc=pass header.from=d.umn.edu; arc=none Received: from mta-p5.oit.umn.edu ([134.84.196.205]:60864) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1ntBL2-0004po-K1; Mon, 23 May 2022 16:55:25 +0000 Received: from localhost (unknown [127.0.0.1]) by mta-p5.oit.umn.edu (Postfix) with ESMTP id 4L6Nk30Z6Wz9vHdV for ; Mon, 23 May 2022 16:55:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p5.oit.umn.edu ([127.0.0.1]) by localhost (mta-p5.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3hkybe-_O-Lg for ; Mon, 23 May 2022 11:55:22 -0500 (CDT) Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p5.oit.umn.edu (Postfix) with ESMTPS id 4L6Nk25Sgdz9vHdH for ; Mon, 23 May 2022 11:55:22 -0500 (CDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mta-p5.oit.umn.edu 4L6Nk25Sgdz9vHdH DKIM-Filter: OpenDKIM Filter v2.11.0 mta-p5.oit.umn.edu 4L6Nk25Sgdz9vHdH Received: by mail-pj1-f70.google.com with SMTP id nl9-20020a17090b384900b001df338b4b72so12020985pjb.6 for ; Mon, 23 May 2022 09:55:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=d.umn.edu; s=google; h=mime-version:from:date:message-id:subject:to; bh=NlQwaLT21pdZYiO4Q5lUf4I+RjlVpn6QNphpWW/B9jk=; b=MEC7CvjLGYlPL+eDpRJpRt+XquhIEg06/GZ6gU/09pSQOXeq74auungqEwdROdxAJ5 uWKD0sBEBN5eByaGGe9Zdnlc6GB/5B7MwZ7oO6CkLdxL7hlJ1GVA/O7V9U3iqTMWn3nK V9wf/aEpajE65kFb22WKbBTsthv8O8jJ0olRJuK0u9VDK9DnefgHIqSjqqAydzYRMyGm pZLbE6Cj3UZ+3RoKBCoUlYpscjoJm9t22SYkqg7elVIQKA3FK67zRjhazkOrNohgMg3d bUHPXmnmaKwlKFwMFvAL/MegK5VQUSIR+HViETSkDhMR+58zh0kRh+n1yOvr373ogOb/ +P3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=NlQwaLT21pdZYiO4Q5lUf4I+RjlVpn6QNphpWW/B9jk=; b=cZQTHZmrOtQiyYdmjP/QjMijTDmsx2sKo3sRB1OdFjVxZolglUL+Hi44U4jOhd4oZK pbeJh2bttNqzkcRfRF/qTDIMqcpcGUjiSh0A8jVcNoCwLT3SrfdZOZIE4kzBBaqBsCux /6SVVGK2uKpQu8NH8rCuqsLhtjBRcSyApmMSaccA9eeuteHsoZrI0cibUD2mIVcLj2N6 r7/d2IFEx1BM/VXqGRrDFOsmqAgUN3rlK+C/8FreJVdZB7QxPuYyNbCSV8KBa3SW4pBY EF3p4mn5ucBZsTYOxVTBAMZxFSeXqiKNTndGCGXRvkWjVThx+5qYKVWkgrGOAt9zroz8 3z+A== X-Gm-Message-State: AOAM530hF3xqNlHbUXbOcLg5O+S9O4iZubSnB19rFukwD8QFfmBY5xUQ WXTO7p8ajDxzoZVjuMsNla3Ca/m4slIhnJR66itndonm12gvaatuBB1PHHA7p6QbipULHhQ19Aq b9sCDJt440jcpBMkzVxotJaOSUbrtxg== X-Received: by 2002:a05:6a00:1991:b0:50e:697:53f9 with SMTP id d17-20020a056a00199100b0050e069753f9mr24599600pfl.22.1653324921290; Mon, 23 May 2022 09:55:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJza+a+Cflx0MJEnfY5MpNugByPnM/aHTu2obONNKpnKtUFHPTtcbHbIPDcofimSKpBmQwprd/7He+b8Br0fbLk= X-Received: by 2002:a05:6a00:1991:b0:50e:697:53f9 with SMTP id d17-20020a056a00199100b0050e069753f9mr24599580pfl.22.1653324920912; Mon, 23 May 2022 09:55:20 -0700 (PDT) MIME-Version: 1.0 From: Matt Zagrabelny Date: Mon, 23 May 2022 11:55:09 -0500 Message-ID: Subject: inconsistency between bash and zsh subshells To: zsh-users@zsh.org Content-Type: multipart/alternative; boundary="0000000000009c20f505dfb0b49a" X-Seq: 27790 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: --0000000000009c20f505dfb0b49a Content-Type: text/plain; charset="UTF-8" Greetings zsh-users, I'm using zsh 5.8.1 (Debian). I am seeing inconsistent behavior between using a subshell in the branch of a conditional in bash and zsh. zsh: zsh$ rm -f /tmp/FOO zsh$ ls /tmp/FOO 2> /dev/null || echo "no /tmp/FOO" no /tmp/FOO zsh$ echo | while read LINE; do IP=$(echo $LINE | cut -d ' ' -f 1); if [ -n "$IP" ]; then echo FOO; FOO=$(touch /tmp/FOO); else echo BAR; fi; done; ls /tmp/FOO 2> /dev/null || echo "no /tmp/FOO" BAR /tmp/FOO Why does the subshell in zsh get executed even though the conditional branch is not? That is, the "touch"-ing of /tmp/FOO. bash: bash$ rm -f /tmp/FOO bash$ ls /tmp/FOO 2> /dev/null || echo "no /tmp/FOO" no /tmp/FOO bash$ echo | while read LINE; do IP=$(echo $LINE | cut -d ' ' -f 1); if [ -n "$IP" ]; then echo FOO; FOO=$(touch /tmp/FOO); else echo BAR; fi; done; ls /tmp/FOO 2> /dev/null || echo "no /tmp/FOO" BAR no /tmp/FOO The bash output is what I would expect zsh to execute/output as well. Thanks for helping me understand this. Cheers! -m --0000000000009c20f505dfb0b49a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Greetings zsh-users,

I'm using zsh 5.8.1 (Debia= n).

I am seeing inconsistent behavior between using a subshell in th= e branch of a conditional in bash and zsh.

zsh:

zsh$ rm -f /t= mp/FOO
zsh$ ls /tmp/FOO 2> /dev/null || echo "no /tmp/FOO"<= br>no /tmp/FOO
zsh$ echo | while read LINE; do IP=3D$(echo $LINE | cut -= d ' ' -f 1); if [ -n "$IP" ]; then echo FOO; FOO=3D$(touc= h /tmp/FOO); else echo BAR; fi; done; ls /tmp/FOO 2> /dev/null || echo &= quot;no /tmp/FOO"
BAR
/tmp/FOO

Why does the subshell in z= sh get executed even though the conditional branch is not? That is, the &qu= ot;touch"-ing of /tmp/FOO.


bash:

bash$ rm -f /tmp/FO= O
bash$ ls /tmp/FOO 2> /dev/null || echo "no /tmp/FOO"
n= o /tmp/FOO
bash$ echo | while read LINE; do IP=3D$(echo $LINE | cut -d &= #39; ' -f 1); if [ -n "$IP" ]; then echo FOO; FOO=3D$(touch /= tmp/FOO); else echo BAR; fi; done; ls /tmp/FOO 2> /dev/null || echo &quo= t;no /tmp/FOO"
BAR
no /tmp/FOO

The bash output is what I = would expect zsh to execute/output as well.

Thanks f= or helping me understand this.

Cheers!
<= br>
-m
--0000000000009c20f505dfb0b49a--