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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27498 invoked from network); 25 Jul 2021 02:15:25 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 25 Jul 2021 02:15:25 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1627179325; b=xicRyZirAmyzEc3786AuBFAAc66fxoJyk/HQtE6I8N1CEDPvz0zq2NAJ4BCRfDTrrU+v8u7rsv 83xbV/3E6dQLhhXxW//eWQa5lPtR3xcPl9Yfq6Ck4HrNg0uuh6DetzHndrjt2up6o3M0r8ZZ/k 9GFzJDIU6QxtvuYBHFJljCfYEmoZ/4bpFrscIktmr6QjLaNbz6iDhCSRLVJIBOE7fZ3CTtWtWn UcKz6ZpIQFBImAvCTlPscovHfzFJsFsD728HICGdMU8Yn8eeSxbb95dJENXSS7PGzBKQYQ1zfF hfjSwp2leOK9ThwIVAGJ0cRJ3fp1AgtcSBB2VTe/amychA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (jax4mhob22.registeredsite.com) smtp.remote-ip=64.69.218.110; dmarc=none header.from=ckhb.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1627179325; bh=EvEioyO1LVe2QjPopA0bDfBf3sxxgrWv7DEbbxSylFE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:MIME-Version:Message-ID:Subject:To:Reply-To: From:Date:DKIM-Signature; b=PiGAtW5E30iDw57T32ZtnMX7fA55E/VDqQbnLYLkuBTmWsJrhIrsdqzcQv+RgkimJrjdz4FrG0 dcQ33xcFWQZ6FyLxAHMunU07b/Igp03ulYi1Rerc4+ElYRM+82zTXjKuWwiDD+lT3/7w60e2AP JibJfAuVFa1ytu/sGlJDM0+TYiCq03K/zCsf/U96PBZYSnx7ArDxN2jet2wlbFqwzaiTRNFlUv ZTCEAvzZcdvEzDBkPkBbhgBbnem4DLbMvHfOWZINQGhFZ9l0NyI55PoIzgeb2+NjJRSSN+1Xnq SDwDDMX8GhKKieU+90wU2wTXlDtqu2XgSo1RY6vjnE9G/Q==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:MIME-Version:Message-ID: Subject:To:Reply-To:From:Date: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=Z0EyTSOmS6QKQbqpCm0BYX/8Mw7zQMhKH7tLlkQoTFQ=; b=u0UkYw5k9eyRHviZDnlrVb+x+z f0L1Uv9wLQx7LTYGX6PBh+9dYtvSqXgn4V2aUuxheIdAOeDfn7ZGfu5rQdPBwxHKwlfdfng0Akk8w LZkP1nzWmXI5dm02aATShubj3jsR6ZINNybHz5JAUMpOAp1aMMNEfKswl7LomQb5SPC99Q4ERqhOG SlMok3wqP2g3AePOE2zntCIvFYveQqzU1A8zcG++NVHUf8HcvDTho4H43C5U9jTF8UYiF8w/pDofr 6spw79c98xDs6e4Nh+clruGGke/b2xoVkPaniDSmTbWt3oSUOT9wRKND4jF6z5ZDB/+MIlqWOAyV1 jYUeDtRQ==; Received: from authenticated user by zero.zsh.org with local id 1m7Tfn-0006Mq-5q; Sun, 25 Jul 2021 02:15:23 +0000 Authentication-Results: zsh.org; iprev=pass (jax4mhob22.registeredsite.com) smtp.remote-ip=64.69.218.110; dmarc=none header.from=ckhb.org; arc=none Received: from jax4mhob22.registeredsite.com ([64.69.218.110]:47662) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1m7Tex-0005eA-PJ; Sun, 25 Jul 2021 02:14:32 +0000 Received: from mailpod.hostingplatform.com ([10.30.71.210]) by jax4mhob22.registeredsite.com (8.14.4/8.14.4) with ESMTP id 16P2ET1i062811 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Sat, 24 Jul 2021 22:14:29 -0400 Received: (qmail 6952 invoked by uid 0); 25 Jul 2021 02:14:29 -0000 X-TCPREMOTEIP: 24.7.18.247 X-Authenticated-UID: scowles@ckhb.org Received: from unknown (HELO ckhb02.ckhb.org) (scowles@ckhb.org@24.7.18.247) by 0 with ESMTPA; 25 Jul 2021 02:14:29 -0000 Date: Sat, 24 Jul 2021 19:14:28 -0700 (PDT) From: scowles@ckhb.org Reply-To: scowles@ckhb.org To: Zsh Users Subject: CONDITIONAL EXPRESSIONS, string == pattern Message-ID: X-Face: Ek1c-Ll9]E|9mF*Z|hf5VSHqF.]0Qv%;h%=Zne"Y3am*(:Tf_BlXI;j'}FMhu%sNCjSk|cxD~oD:g5Tv,gN}{Y8("m<8<%%=_vy MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Seq: 26805 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: I would like to execute test on patterns that are dynamically generated and that change between invocations depending on other data. When I generate a scalar parameter containing the pattern, construct the test statement, then invoke it, the test fails. However, if I force an eval on the test statement, the test succeeds. I do not understand zsh parsing in this case. Could someone please let me know the mechanics I am missing? thanks very much. zsh version: 5.8, patch 460 platform: x64, ubu 21.04, current patches # test code begin: unset vs vp r local -a r vs=' str1 a2' vp= vp+=[[:blank:]]## vp+=str1 vp+=[[:blank:]]## vp+=[[:alnum:]] vp+=[[:alnum:]] r=( ${(f)"$( eval echo 'test ${vs} == ${vp} && echo hi || echo lo' )"} ) echo ${r[-1]} test ${vs} == ${vp} && echo hi || echo lo # test code end. first test output: hi second test output: lo