From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id D22972396F for ; Sat, 13 Apr 2024 21:46:23 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1713037583; b=s2VrMxBQ7944jfLtbEVVCjeGRIeDTaOMHkjt9WSyR6V/Gd/3psFDsfDXXbcUYqrnKYTGznUxV3 zxtRHT3twrWISqWDkx8kb/Qz7MB7RX+d+VWSBQty088sLWDlTG0gRLJHPHNY0IH30zlXmKVBtx O9IgrIBW/ZwTIHy9EGNW6rUTcmel1zAlxfzH8zW1uvON+elTpGK0vdUpJ67sIbfT4JBbNq9rLw LYW4YKLwI0dss+Ieea/mDs89ky0bqt0hC6JwNJulMBOmADczX8KWCkAlgfm5PPIRPcQCossu3v hjVfiwc1ntzG1RwNlvWEj9bFlA4YJTzBWL1YgTA8mC1WrA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f50.google.com) smtp.remote-ip=209.85.218.50; 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=1713037583; bh=2/isvhbKkYrfRTFLlehVG8I6OiE1S/NODUxyp5XKUEw=; 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: DKIM-Signature; b=a+MH28YGR7lCHyVzAddXgt5IDQS51lHjN3cplL4+F5LVid/WfmA+llpchbV/XUfBTMWYfA82D1 RpAwfPI5Xi/evJ/9HaKgEwlJhLsZftTjfljAvOHpVpV9PfD9xJVvvmNGVlvXKdn9BjygkatgXe WyPs3yD4ewH6Y2IJYy7epadQwo2IH2jAlYvgSrhhvFR6oHJKuJDeMAJ5D6hnPSv86/n4pq5L6u a9WDIX8aFs5fXNigAbJBdConU2jUi/o6BP2wJzBrsls7DyZ/D8sggZA5/XLhpo7IJtstc+vEjp Qyn41iV5aAIJ6L4McVzONIpWsOzAhyJOC8rDOoOYRQNH3w==; 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=1+OVF/g5SzrVArg0FFnOrft61pIzfG9msby5+8CEojA=; b=rQTW7PDiCgipuwaDwuhc+2w6Nl pHeXYoiKzpyUWtuyhE65P66nkMzGCS8HBByAXlLOw1PZdJ41RhMslUP82Nvddry22DpBQ9veloC4L z8p8qih/ppz7WqKuwFqEyjg2YFFVKTC7vwyQ7BgpAe6xTJ9ZIpJFNybYVLNuepMaCLbXdw6xqs50l Lz34SO5D6A59X1qyjLEyN8XWtODVqFsLbGue+qdNTuylnKTE40VBoVg9CWLTyZFGK7PaLT9qUDDLr 7zIo/Q48ypGpHWkMTCk/zKeuhCyJe6q49iwf7JVRyCKuzWCC+/I86on4wwikU4sEb3MNkOtA0+Aia P+uKY0LQ==; Received: by zero.zsh.org with local id 1rvjKQ-000NzC-MT; Sat, 13 Apr 2024 19:46:22 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f50.google.com) smtp.remote-ip=209.85.218.50; 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-f50.google.com ([209.85.218.50]:56754) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rvjJV-000NCB-Hp; Sat, 13 Apr 2024 19:45:27 +0000 Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a5257e64ec8so25354066b.1 for ; Sat, 13 Apr 2024 12:45:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20230601.gappssmtp.com; s=20230601; t=1713037525; x=1713642325; 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=1+OVF/g5SzrVArg0FFnOrft61pIzfG9msby5+8CEojA=; b=ohYgROJpiTucrXo1+2t/8wKNoS5o3cZHNwA3AfMGPKVQuV6pmS7EgaEQeXmgkpDt3h MOv+pEegvNOYuwCEil2KNf5U+apnzL7aHzUk6eTHlLMpa07a0zYui38iZpedmD/aq71B otTZTm5GSPs/NQ0hVXi0gNpW3xv7emAG9+ZMX3M04cD9W0+9WTc2M15PkBh5OKztmHRi vlfhmMHR/JWGW6ZDBhWw3Ki9c0YR7Si+qunzvDeIQqP2Kj/5XcTlAlnLOdMg48Ibbtii 8bVhiKsQgNbM287ndn339RoOpLRi/TeaPLawUGtb/kJ1liHzSw9kqpRDEufOpN7MeXCF STtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713037525; x=1713642325; 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=1+OVF/g5SzrVArg0FFnOrft61pIzfG9msby5+8CEojA=; b=MFZvnVY11NhfDOF89J3ZpEupE/uaF8qkvO68AB6t8M8NcScwyPnY1nEUlh/OGxIbbW ploMCA/C28qSnB/WUxCoRed0BpAwHi3DYOT2k4trpkgX7ZkLRVX8njwbdLjuwhfqNAkX XMMAY4IaVNdh35f0dNnfAPVmkeSqOIafhZCfeQU40PbxvPeiBwDNm2BAIvJKqOaSslmN +pN0tLaOQWBcZPU+qoX8AoEROJMnOXcuoCWvt+NdL07/dw3dvRre2+QGn2SagqME36i0 pr7Xwr/VftOBeT/iVBNhRTS9bU9fXITkWUNmhlqEZ17pJVF/eAnyB7rRM+7brs2QrPn7 V3fQ== X-Gm-Message-State: AOJu0YwZJgrYgZWx725lCYbK+wWdaub2jAbbtuyOWjqGudz572JDWydG HqVVRnAqceFk0j51HoSkkfmDs5a8fhbMCsXbSOMiGHxgIM35+CF1LtI1jNBYEHY6Nv4UfuYjwuI 9axz0T/lR8cWElaz+qQ4xuXW6g1SUqatDG+kM X-Google-Smtp-Source: AGHT+IEe+tpNAesHdURJOATddEbcR5fSCZb1LoM08WlqMhuppNYEscg2BsVcHGUZTHGsSYFo/wnvFhkLV2aSzcbNbC0= X-Received: by 2002:a17:906:5fc4:b0:a52:143c:1901 with SMTP id k4-20020a1709065fc400b00a52143c1901mr3699204ejv.22.1713037524527; Sat, 13 Apr 2024 12:45:24 -0700 (PDT) MIME-Version: 1.0 References: <97793422-1543-4ba6-b52b-ff93eba03ab1@eastlink.ca> <7ba17739-6024-439b-a4a7-dd88fddfa2e4@eastlink.ca> <7333cf23-1fe7-4b3d-a7c1-f07697c5f062@eastlink.ca> <1e53a3f7-9bdb-45ae-81c7-7d0ec1a6a541@app.fastmail.com> <3cc19e86-e953-4e2f-9e57-30ff84f15fdf@eastlink.ca> <0a0b9ec3-4661-4386-9fbf-b3152a46001e@eastlink.ca> In-Reply-To: <0a0b9ec3-4661-4386-9fbf-b3152a46001e@eastlink.ca> From: Bart Schaefer Date: Sat, 13 Apr 2024 12:45:13 -0700 Message-ID: Subject: Re: triviality regarding $# counts To: Ray Andrews Cc: zsh-users@zsh.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 29807 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 Sat, Apr 13, 2024 at 11:08=E2=80=AFAM Ray Andrews wrote: > > But I'm still not happy with the dollars. I had thought that " $'...' = " was grammatical but we have " ' ' " -- meaning an empty line There are three* forms of quoting: 1) "X" -- expand variable references and other substitutions in X, but do not split on $IFS ** 2) 'X' -- do not do any expansions, X is literal 3) $'X' -- interpret \n \t \e etc., but everything else is literal, as is the final result This is all explained in the manual section "Quoting". "typeset -p" will output either no quoting at all, or #2, or #3, depending on which is most appropriate to the value of the parameter, such that the entire output is printable without the possibility of events like terminals interpreting escape sequences. If the parameter is an array, "typeset -p" may output some elements in #2 form and others in #3 form depending on the value of each element. Note that because #3 is quoting, not substitution, it does not expand inside #1. Conversely, backticks `X` only look like quoting, they are actually substitution equivalent to $(X) except without nesting, so they do execute a command when appearing inside double quotes (#1). * Four if you count using a backslash to protect a single following charact= er. ** $@ and $ary[@] and ${(@)ary} get special handling, their array-ness is preserved with each element quoted separately. Let's look at your "redline" function: redline () { echo -e "$red$@$nrm" } The special handling of $@ means that for example: redline a b c is interpreted as echo -e "$red$1" "$2" "$3$nrm" So you probably should have written redline () { echo -e "$red$*$nrm" } because $* is the same as $@ except without that special interpretation inside double quotes.