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 662FF23D48 for ; Fri, 12 Apr 2024 21:10:10 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1712949010; b=hGTwkksbHJNvjzprjHI7XF3w02NYwRGgjg89ulgdVODhlg4fewZiz5aOMu/p8VfQeKcSQmmc9L 5BZCPk8g/iZ6rAgtFs77tb27jAevGrccC2vqvAuUZqYtNKJWuMoPY2zxfm/0RTf0SBOwyeu4DS EIW+NnlvyVFGRM4eQ4kcaYPdsZ/z7VjHIntwqSzIifPB+9krxRcuNgbSuVt+NRiC0U/5o2m0OZ uy2rW0XYHLb9KF+cR+TYPybntFFza71oGXeMrFhEmFo20UDJ9qEgTfWs0g7gn3/hnI1l7DYwgf T7QZhxQnB8hdqZupKdjnCj/fs7n3rJn94zkYrwSzWMI0ew==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ed1-f47.google.com) smtp.remote-ip=209.85.208.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=1712949010; bh=L2YAmuHLtH6gb5y8xP+ADIDO3X+6wloKj4Eu9dEhDVM=; 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=MhTZDE05V7Am22tmJ/vQRmgpNz5QXisMHWsaHFCvNhkmc5u3XKkkij2WlK4CMHw/NAegVcwn0n TO4dGTxgibGYCZKXd6F14zgWy+QJ+0pusjU7LQST01On5ibNNnoRNHjVxBECkj4VQTAh3SgoNd n2OrLlmUZvD62LFSDc5kkUT2jElMVF0hIdoJ49Xjp5QjfrGpbdGNjha4N5h3XNJIS14lhMXJi1 nE+P1VGX32B/0VXyX33nzpLKIjeNUenR6Yo89NNFVlnXV4ntJr443Ar0uZWUdooK/zMP0K19mR 9a12jWDVqPcPoG32abAy1DHAIFwiPyMtqMhRFLQnasq87w==; 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=xoV9KLRhPbZYFEq2ntJwSnYRjG5+U6nwhxbHvEnKWJg=; b=HXtRxX4Xe7Enc09FY0KUOtQ2Mq 4wv6i6xuAqSNvEho4tOpvVbAcd77lGNfLFZ75HiCrrtICQVO9JaMRScXuysYbfv+I6PokbJ3pCrIR Lu5zVK393/EyOGe7Uuh32BC8MxO+PJrfwheyx9cPSYFqOhu6qaAEIhuthID+4e9p109oIlMSpKNb0 l4ULyP7/Mi8GfJR4WOpUNwdYJa1ujh8y4tN2xNDZTWVv2Hh00YQKacPRouBTopSAtzct200H++bp6 jikxvRf54yGc+8ZsBRWCq4/4RL+gqUjqicT/ejPFrdNB8PSFgwrbhlaxfUSjiJBxI3yQKiw1PiHIy pSQCJEgg==; Received: by zero.zsh.org with local id 1rvMHq-00016a-Ow; Fri, 12 Apr 2024 19:10:10 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ed1-f47.google.com) smtp.remote-ip=209.85.208.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-ed1-f47.google.com ([209.85.208.47]:48143) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rvMGy-0000Kx-VJ; Fri, 12 Apr 2024 19:09:18 +0000 Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-56e47843cc7so1272905a12.0 for ; Fri, 12 Apr 2024 12:09:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20230601.gappssmtp.com; s=20230601; t=1712948956; x=1713553756; 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=xoV9KLRhPbZYFEq2ntJwSnYRjG5+U6nwhxbHvEnKWJg=; b=Zgjy4VZWw+ozL1ATcjEClWmUOgtsgYUfPA8+isiNneyzMfBHqsFP+O4yhESnt+ORzV vjc8Zly6/K8ciggr/lSVc/qIN4gbEJNQdtMeLCwWdEXe+XinsBliHaqivdt6jASt9qWZ kGn20Gx7jsd562LGaIlGRr3YM/8dlQEk4jfR5DPO4hietgGpp8EJbn40b1w1czdnEkOC CmKey4UDvEqFk+ENAkQcTM/BK20myZm75FoqViX1vO9/8a97sUlrfqGXDNAtIGIQYEv7 SdnN+UFS2d5PtAgXgfiJxy1Ya0jmjwdFbY7ERvWIxu7kG9qFMqcZ2XBCnuR8/uRQzAfZ SPDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712948956; x=1713553756; 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=xoV9KLRhPbZYFEq2ntJwSnYRjG5+U6nwhxbHvEnKWJg=; b=hWGhkeDFHzjvW0yNeYV2N4JyUtZx/64Ldym3wNoaxq+hA9cjLRNt3cSOGHXWVWuzUl TnTQApnZILU2hrVApiAR6+bpLxsJBohX/xCe9xWCIwKcTfQiAxBRBUhz7GmiMi7zzYBy ed5FhKUnyqqv9dMu48O6bXlODUFwxmgQvavm2FvelXHpfh3roFzYjpvAPJe2aOci9mTk 1vZRTlqynU1CEwGQYqnhufsronhmOf5uPvA/ChNyPGT2m4gN8mbfqyKtS9rCSKaMhKpt wIKV8oqzzBoZA9KFLyPSXTM3oPW0EeKW41pS4FQXVaEnIju9abDaaHGiBSAnac4Su8JR XHqA== X-Gm-Message-State: AOJu0YznlEAAJEue9liUgqCE7ZsspKVVcBBCA2qJkfMCB74oQGvPwq2G b0L9BkJTxXk8RbvgCaZrralX4up+8Fu0yP07BN9qCALBX8gnBT8PSPiDECa5slYeJ750cbEn6sn 5zhHHqvpbq6N4WDtMQ1d1qyM4pIRLiD+Qr6IY X-Google-Smtp-Source: AGHT+IFKcnRpv0s6a9cpIMvSerUzNz9bMgDEaN66A4uV7bixKkTHV8xWwGHGqbRNY5CzvyHP5uwEF1le7tPBO/DzxlM= X-Received: by 2002:a17:906:dac1:b0:a52:241b:b450 with SMTP id xi1-20020a170906dac100b00a52241bb450mr2530034ejb.36.1712948955851; Fri, 12 Apr 2024 12:09:15 -0700 (PDT) MIME-Version: 1.0 References: <97793422-1543-4ba6-b52b-ff93eba03ab1@eastlink.ca> In-Reply-To: From: Bart Schaefer Date: Fri, 12 Apr 2024 12:09:04 -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: 29796 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 Fri, Apr 12, 2024 at 7:49=E2=80=AFAM Ray Andrews wrote: > > For now, what I'm wishing for is a nice, focused essay: "How to use '$#' = to count whatever it is you want to count -- characters, words, lines, para= graphs (at one point my count was '3' which I'd approximate to being a para= graph) ... and all with or without spaces and/or empty lines. " None of that is about $#. $# just counts either characters in a string or elements in an array, full stop. What you're asking for is a dissertation on how to split text into arrays. I have no idea what you mean by "without spaces" and there's no inherent definition of a "paragraph" so the best you could get from this is characters, words, and lines -- but even for words you need to explain whether you mean "shell words" (separated by $IFS characters) or something else, including whether quotes matter. Further, you seem to be starting from scalar text sometimes, and text that's already split into an array other times -- in the latter case you have to explain whether and how you want the array re-joined into a block of text before re-splitting. The shell is not a word processor and doesn't understand your conceptualization of text formatting.