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 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 24403 invoked from network); 12 Sep 2023 20:07:59 -0000 Received: from zero.zsh.org (94.142.241.90) by inbox.vuxu.org with ESMTPUTF8; 12 Sep 2023 20:07:59 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1694549279; b=GCdMOliVJr16tyOOoAA9Zde8BKTZn1koc5QXe41mjiFw+JI3AYHRDxgj7UHnhdSn48nlwinK3f 2acbDOWEzesOHOCtNOgKAdOGtP8MFmC7gFS0z3BqMUTBF6d/sW1Hcy56s1Qd/h4IuDQA5Z3E+w mZSN21bN/hUnRuhXYWF8K5DeuThNaC1PKtsTR067/A4OtNlyzoJmNT+rE4hkzMws4WbG9S4uR4 r4mliLTI+yZXSR26+pkdQaTTLfyDVdAva9rRAG4FBRgXIZXG+6+NImjOshgvA9s0zQY7SO9N1F iHuUOGkskfdlfbvs7FOzl4itfRsX5+aL/mJQkXTpHxLLvQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f47.google.com) smtp.remote-ip=209.85.218.47; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1694549279; bh=+7Q9wBkm8K5OGWQMEcBR/+9ZFmm35BqiqWBJG2e5+b0=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=Z4v0SYkDghUti/QZ6pJCwbuDIYidld5Lpcr0V6MBasZ6gRQ8uVIBux3+aI/fMB4Izi7I5wFQ26 ShdDrFtd6cCeRCC6qo3X20nowttWnpB9CIaz1wkroNvuNaNjMrSzm3q9OcVJgouJl2IPnF/P0+ mZ3BARpdm6TQ/nQ/9HG+NhhIVV/FeZYbQ/cMZ5Mhompmmyr0Hc7ZELu6TwsdFFgXEdOkF8nXVd vLihDdRmlwaSac93EQCv0Ar3H9OkG05kCXo+umDwi6rQCeIf8gk9GmqO9aTihgbxcrs792Bd3r pNYm+NTZMprbbVXW2n75brFXLfQ5q/vY3eEzs/f49puegw==; 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-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=coCwfREJ1yUSKpJHTNm/l9QrowFPCcL3A/Vo2dA7iDs=; b=AZN6h0x8XRylxJ6i/9dUZucCxV rbLr+2c208NoXkK+vdsaJ3ahIB1krQQEyMpSLbg0ZiVLecfLkKbKvAL09plN/IVzlT7KnDZxGemhI V/k5KzwLoRuN+P8olqJQbpRQGhe7Zy22uc+cKHAuhH05KW6cNz1zUhN3v77GS8rcyRk0KXPUcYIvo rAlNPZmzS7jMgH2wZyMdyiG57fpaAhX2jSiM455Y84591X998Rb1fL783ncoWjKrxdm8TJ/mL7mqO hx7GqqXfC9ZX0WIPy5sSSs8x8pOKBxacJzALPSrmZQefyCJJZ/wAYTdyttY4YuTIvEL99nKYUvpXZ 8bM+flBA==; Received: by zero.zsh.org with local id 1qg9fx-0001ri-Ep; Tue, 12 Sep 2023 20:07:57 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f47.google.com) smtp.remote-ip=209.85.218.47; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ej1-f47.google.com ([209.85.218.47]:48149) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1qg9fC-0001Cl-Gg; Tue, 12 Sep 2023 20:07:12 +0000 Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-9a9cd066db5so772090266b.0 for ; Tue, 12 Sep 2023 13:07:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20230601.gappssmtp.com; s=20230601; t=1694549230; x=1695154030; darn=zsh.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=coCwfREJ1yUSKpJHTNm/l9QrowFPCcL3A/Vo2dA7iDs=; b=D18k4zV7sgU5TOdLH0PBc+7lP2ECS4+1p/3UDOQjPIdWxfGvrpKl3I/sARNcTVpGRJ WN6A3DuuFVQmJaBujrKl84YLiUfKnHCaiaF7k7bYbtMZ3n893I3xIPWvG/bugVB0o2Jt xuuBCwnM0a4EAgK1l5sFxw5k5ilHWyPhbLA37dsujJHkTOfpN0Cg3OumI5hKajx2WwEZ bh+ZqLfgtBurmvTCoeKBwFOU3HG0O0ESoP8KJ6SXipwFBEtDbNw05mfUZ2tQukQU4Ooc zTgvX83NnedWUJkf2jTDP3rJ2obvai6gGvsFsn/WtGHGFF8AHGGoyAtZXy7QUkcG0GuS k5cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694549230; x=1695154030; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=coCwfREJ1yUSKpJHTNm/l9QrowFPCcL3A/Vo2dA7iDs=; b=mD8ajYFD4Gls+H3L4+JU1fa//8n5bRe/fy0Vg4yqNTmwhK5vV5mmnrHXx3sW2Z/40C xB+p2KtKCR0NlrBzWo4zrGJr81F/avj81IGCU9mdaIThuS/40LGHsvNBlDDHw8Py/fF2 Np0b+KU/kwQOz1m9nO2Pkht3CdEfIM32LPsl2kfNluPpwnlMii61pwu0e7PoJDkGVOle jinLk8A0YYbDoe3obDClRub9/DcbWSkAe11/GxL2Aq7tNo/I+gHMum9dC/ieLE48jCwZ jcCWrVv6vAqmd0tnfALAZToSdWYuBubkRTQmYE4SSJ8TW2ueew5auFyEFdfvHuc4cqQM QApA== X-Gm-Message-State: AOJu0YwKGLkLWR77xH10ytHo6U54VYvpnrj6jrUeBBh2Ur+wkZG0dVdw M2Ol8TJ7/r7ZW4hK6uE2aio9zkoWsG7MxFRW3E3aW8P98252PrzY89k= X-Google-Smtp-Source: AGHT+IHBWiK1cpw1a6xTHOQakwtHMPn9PCPGgEU+ffdUxHMNLR6qzqg6r3afkCRvf7yKaSdYKRWDFDFjwT8Mf1+/rSE= X-Received: by 2002:a17:906:1db1:b0:99d:f056:5d6b with SMTP id u17-20020a1709061db100b0099df0565d6bmr283410ejh.20.1694549229850; Tue, 12 Sep 2023 13:07:09 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Tue, 12 Sep 2023 13:06:58 -0700 Message-ID: Subject: Re: quoting question To: linuxtechguy@gmail.com Cc: zsh Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 29232 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: On Tue, Sep 12, 2023 at 11:46=E2=80=AFAM Jim wro= te: > > Zsh quoting at times makes me wonder. Do quoting? Don't do quoting? > The following case has me scratching my head. Can someone explain what i= s > going on? This doesn't directly have to do with quoting, rather it has to do with ${param} expansion and brace expansion. The short answer is you should never have unquoted { } inside the ${...}, because the first } encountered is usually going to be interpreted as a match to the ${ and not to any other { in the string. Where double-quoting gets involved is because inside a double-quoted string, none of the pairs of { } have been tokenized, so the lexer can't distinguish which of the two }} is the actual end of the expansion. That's what happens here: > DT=3D"${(%):-%D{%Y-%m-%d %H:%M:%S %Z}}" > print $DT > 2023-09-12 13:21:40 CDT} <-- why "}" when quoted The string is read as ${(%):-%D{%Y-%m-%d %H:%M:%S %Z} followed by } because the %D{ is quoted (not tokenized) so does not lexically match with any closing }, so the first one ends the ${...}. In this case: > DT=3D${(%):-%D{%Y-%m-%d %H:%M:%S %Z}} > print $DT > 2023-09-12 13:21:40 CDT The inner { } are tokenized and checked for whether they constitute an {x,y,z} brace expression. There's no comma, so they're left alone as a matching pair, and the final } matches the opening ${. You can see this by inserting a comma: DT=3D${(%):-%D{%Y-%m-%d, %H:%M:%S %Z}} Now %H becomes the home directory instead of the hour, etc. If you setopt ignorebraces you'll see that all five examples work the same and always leave the extra } at the end.