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.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,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 7DBA9211B5 for ; Sun, 14 Apr 2024 02:33:30 +0200 (CEST) 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:Subject:To:From:Date:References:In-Reply-To:Message-Id: MIME-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=m4L0MpT/K2ZsASCseRe+HUiPJti8nKYtnQKFVMwTJpk=; b=T622Kx09aJH4G0EmSB5UscSUUT 1A+EeZaMw4+1mcHdXflkH57vVypK07Xg8aANGgYdT3gAb0t8plie3PhZCivRU2h2DWMXtVayrDV6Z Y5CaoAea6P62QUEsb/5yL64m3ZFhG4VHMsC9QPBNdOzK7EsxA4fzFwWmqM0yutr8/9JGIWe5K+vEB a+b51/NXj43o3pl4l5OFvl4in1cQIlOrnl+RyBAjh9JAJY+FsJY4rdcOa8d2RRCjuCO1TJb2eYxk0 uw7D6wBet9kUZtXdNSFv4pjN35x9qbPyyG4tO6hpwslbkC5W5hnR/YJ3+L+O9PfghkUskGyauOX5j StKdIBKg==; Received: by zero.zsh.org with local id 1rvnoI-000CNp-5U; Sun, 14 Apr 2024 00:33:30 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1rvnnU-000BeU-Ot; Sun, 14 Apr 2024 00:32:41 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfauth.nyi.internal (Postfix) with ESMTP id 594911200032 for ; Sat, 13 Apr 2024 20:32:39 -0400 (EDT) Received: from imap48 ([10.202.2.98]) by compute2.internal (MEProxy); Sat, 13 Apr 2024 20:32:39 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudeijedguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtgfesth hqredtreerjeenucfhrhhomhepnfgrfihrvghntggvucggvghljoiiqhhuvgiiuceolhgr rhhrhihvseiishhhrdhorhhgqeenucggtffrrghtthgvrhhnpefgffeghfehjeegtdeitd evgeehgeehjeefffeffeefieeguedvtdegtdetudeufeenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihvhdomhgvshhmthhprghuth hhphgvrhhsohhnrghlihhthidqudduhedukeejjedtgedqudduledvjeefkeehqdhlrghr rhihvheppeiishhhrdhorhhgsehfrghsthhmrghilhdrtghomh X-ME-Proxy: Feedback-ID: iaa214773:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 18ADD31A0065; Sat, 13 Apr 2024 20:32:38 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-379-gabd37849b7-fm-20240408.001-gabd37849 MIME-Version: 1.0 Message-Id: In-Reply-To: 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> Date: Sat, 13 Apr 2024 20:30:16 -0400 From: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= To: zsh-users@zsh.org Subject: Re: triviality regarding $# counts Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Seq: 29814 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 5:01 PM, Bart Schaefer wrote: > On Sat, Apr 13, 2024 at 1:36=E2=80=AFPM Ray Andrews wrote: >> >> On 2024-04-13 12:45, Bart Schaefer wrote: >> > redline () { echo -e "$red$*$nrm" } >> > >> So, compared to the previous expansion, how would '$*' expand there? > > redline a b c > > would mean > > echo -e "$red$1 $2 $3$nrm" > > One word, with two quoted spaces, instead of three words. > >> I'm unclear as to the practical difference. > > For "echo" it doesn't matter because echo is also going to paste its > arguments together, but it might matter to some other command. A different output method should make this clearer: % f1() { printf '<%s>' "x$@x"; echo; } % f2() { printf '<%s>' "x$*x"; echo; } % f1 a b c % f2 a b c The command "printf '<%s>' ..." outputs each argument enclosed in "<...>" (other than the format string itself). Observe that double-quoted $@ can expand to multiple words, while double-quoted $* always expands to one. This actually makes a difference to nearly every command you might think of, with "echo" being a rare exception (and even then, only when the first character of IFS is a space). % arr=3D(.zshenv .zprofile .zshrc) % set -x % wc -c "$arr[@]" +zsh:44> wc -c .zshenv .zprofile .zshrc 1063 .zshenv 1023 .zprofile 3807 .zshrc 5893 total % wc -c "$arr[*]" +zsh:45> wc -c '.zshenv .zprofile .zshrc' wc: .zshenv .zprofile .zshrc: open: No such file or directory --=20 vq