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=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 19867 invoked from network); 3 Jan 2023 15:58:34 -0000 Received: from minnie.tuhs.org (50.116.15.146) by inbox.vuxu.org with ESMTPUTF8; 3 Jan 2023 15:58:34 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id D3949424EC; Wed, 4 Jan 2023 01:58:28 +1000 (AEST) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by minnie.tuhs.org (Postfix) with ESMTPS id 57467424EB for ; Wed, 4 Jan 2023 01:58:25 +1000 (AEST) Received: by mail-wr1-f53.google.com with SMTP id j17so24567014wrr.7 for ; Tue, 03 Jan 2023 07:58:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=wC2gwXVAclZ9Zg9SNOnPU0mkkAv+Jel+JuUgtLBEu6w=; b=G/hgo5Oy75SsS8NANoi5jkPbJCqwx3oV3HBrzDziTLuxFvmngKLNauFoAK8fm7PNKE Qv5UyVDY6s4odI6aJL+qCEI8S8PrpZa+u+nadqIoC2mcPmDkyf+n4Ff3qGXXNeyYf3G8 8ncmGx/PWbvZUC5zn5kEknSK9A94M0rhvf+Eg5aNaQaUPzfgCYQa8sa4Swag2yWlGyU2 o53OHnGToXXXqyKwuB46uBcIj8pshywoPiiHDtH46FG6o0RpDbHUzoBd+4jAn3/AuQq2 PZtmPIQ/IoYbL/iXaqQVs6h2NfaM59xZBaHs8lBnahhvKUTgQLoVC9HBrQ1i8ZPneVsL abBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wC2gwXVAclZ9Zg9SNOnPU0mkkAv+Jel+JuUgtLBEu6w=; b=JPT4WmbEb5YS7nspApX022g174BrMYOGsIjSegtiDHUgADckDi3ckMQAISXjhC303P 1wIUUV9M/TsyIQLuyipcScBloBpp1guwylC2l08ySJ2hCqVh3y7cKjby+QT3fE1W9jK5 Jri1kPRhQl8X7rMwAe8RVCG+Mo/urmXNYx15Ccf64ip3Gr99ykjTCwxTBE5Ci7BnIi3/ 6hMPGjgNJGwyd2Vd+AkU7I3hVtv9g+LcwbY+ch4bkzPhFbfsYqnsjoP9W3q6s+WGt721 7Jcb91ehiewrdnYN8eyddAPreTlQ/xb8Ov1IvYybV9D6YcUU4aPDntVdaboU9hmJGqoE eJKw== X-Gm-Message-State: AFqh2kpdlPGHdJQg57gzZqKAJUQNMyDr3YLhcjpKZIya6vukln+up4RC 569j7B3p5qwFW6W04qEDAAc= X-Google-Smtp-Source: AMrXdXukB5eemUUydwW5eIepl6L0JEOdx2UybxTB6pVSylWuG0mk3nqRSNEQY8i5SY2/cwyetZ3A+Q== X-Received: by 2002:a5d:43c9:0:b0:280:15ab:4d5c with SMTP id v9-20020a5d43c9000000b0028015ab4d5cmr18858761wrr.66.1672761443657; Tue, 03 Jan 2023 07:57:23 -0800 (PST) Received: from [192.168.0.160] ([170.253.36.171]) by smtp.gmail.com with ESMTPSA id l17-20020a056000023100b00241fab5a296sm31310580wrz.40.2023.01.03.07.57.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Jan 2023 07:57:23 -0800 (PST) Sender: Alejandro Colomar Message-ID: <3a891e61-a8b1-cfe4-95ab-c60e6ac6eb42@gmail.com> Date: Tue, 3 Jan 2023 16:57:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Content-Language: en-US To: Douglas McIlroy , TUHS main list References: From: Alejandro Colomar In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID-Hash: IHO25GSBU7TO6Y6JWK2AG6U6GD62T4QX X-Message-ID-Hash: IHO25GSBU7TO6Y6JWK2AG6U6GD62T4QX X-MailFrom: alx.manpages@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-tuhs.tuhs.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [TUHS] Re: A few comments on porting the Bourne shell List-Id: The Unix Heritage Society mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Hi Doug! On 1/3/23 16:08, Douglas McIlroy wrote: >> segaloco via TUHS writes: >>> I think that's a good point that scripting problems may be >>> a symptom of the nature of the tools being used in them. > >> I think that you're hinting at something different. > >> To the best of my recollection, scripting languages were originally >> intended and used for the automation of repetitive personal tasks; >> making it easier for users who found themselves typing the same >> stuff over and over again. > > Indeed! Well, as time goes by, I'm also writing less and less programs. But only because I find that I can pipe programs together to do what I want without having to write a new one. I guess that's a fair reason to not compile :) > >> Somewhere along the line people forgot >> how to use a compiler and began writing large systems in a variety >> of roughly equivalent but incompatible interpreted languages. Can >> one even boot linux without having several different incompatible >> versions of Python installed today? So I don't think that it's the >> nature of the tools; I think that it's people choosing the wrong >> tools for the problems that they're trying to solve. > >> Jon > > The forgotten compilers were typically used to supply glue > to paste major tools together. The nature of that glue---often > simple data reformatting--inspired tools like sed and awk. > Each use of a tool became a process that saved many minutes > of work that would in a scriptless world be guided by hand, > boringly and unreliably. > > Yet glue processes typically did only microseconds of > "real" work. In the name of efficiency, the operations began > to be incorporated directly into the shell. The first > inklings of this can be seen in "echo" and various forms > of variable-substitution making their way into the v7 > shell. The phenomenon proliferated into putting what were > typically canned sed one-liners (but not sed itself) into > the shell. > > Lots of specializations crowded out universality. A side > effect was an explosion of knowledge required to write > or understand code. Such is the tragedy of "forgetting > compilers". And a funny thing: Today in the era of multi-core computers, not only the shell-only scripts are unreadable, but they also are slower than scripts with pipes and little-to-no shell features. I tend to write scripts with only pipes. No shell features. And I also avoid programs with many options (find(1)) when I can split it with xargs(1) and others. I remember some script I wrote for maintenance of the Linux man-pages, and I received a suggestion that I could "simplify" the script considerably and make it "faster" by reducing the number of pipes using some features of find(1) or sh(1) (I don't remember well). Well, I tested, and my long list of piped programs outperformed by a fair amount the suggested alternative. I didn't care enough to find out the reason, but I thought it could be because with the pipeline, I could run each small process in a different core, so they could work all at the same time. With a single program invocation, you're bottle-necked by that program, which is limited to a single core (normally). Cheers, Alex > > Doug