From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,RDNS_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 Received: (qmail 9227 invoked from network); 18 Mar 2020 23:55:22 -0000 Received-SPF: pass (primenet.com.au: domain of zsh.org designates 203.24.36.2 as permitted sender) receiver=inbox.vuxu.org; client-ip=203.24.36.2 envelope-from= Received: from unknown (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTP; 18 Mar 2020 23:55:22 -0000 Received: (qmail 18538 invoked by alias); 18 Mar 2020 23:55:09 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45577 Received: (qmail 20359 invoked by uid 1010); 18 Mar 2020 23:55:09 -0000 X-Qmail-Scanner-Diagnostics: from atl4mhob01.registeredsite.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25751. spamassassin: 3.4.2. Clear:RC:0(209.17.115.39):SA:0(-1.9/5.0):. Processed in 1.289403 secs); 18 Mar 2020 23:55:09 -0000 X-Envelope-From: scowles@ckhb.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at ckhb.org does not designate permitted sender hosts) X-TCPREMOTEIP: 24.7.18.247 X-Authenticated-UID: scowles@ckhb.org Date: Wed, 18 Mar 2020 16:54:27 -0700 (PDT) From: scowles@ckhb.org X-X-Sender: picmar@ckhb02 Reply-To: scowles@ckhb.org To: Zsh hackers list Subject: using dynamic patterns on the left hand side of case statement clauses Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) 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 i would like to use dynamic patterns on the left hand side of clauses in case statements. i'm working in zsh current as of 3.1-91-g7595b22e on ubu 19.10. the options set for this example are: setopt extended_glob setopt glob setopt no_no_match setopt no_null_glob the code is: typeset -a a b c a=( one two three four ) b=( 16 17 18 19 20 ) c=( two 20 ) vb=$'|' for d in ${c} do case ${d} in $( eval echo ${(j:${vb}:)a} ) ) echo "1 found it" ;; $( eval echo ${(j:${vb}:)b} ) ) echo "2 found it" ;; * ) echo "did not find it" ;; esac done but, when i run the code, the interpreter escapes all the vbars and forces the entire lhs pattern to be a string. does the case structure not allow this use case? or am i just missing something from not reading docs carefully enough?