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_INVALID,DKIM_SIGNED, HTML_FONT_LOW_CONTRAST,HTML_IMAGE_ONLY_32,HTML_MESSAGE, MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 3375 invoked from network); 2 Jan 2023 19:52:25 -0000 Received: from minnie.tuhs.org (50.116.15.146) by inbox.vuxu.org with ESMTPUTF8; 2 Jan 2023 19:52:25 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id BEC4942492; Tue, 3 Jan 2023 05:52:04 +1000 (AEST) Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) by minnie.tuhs.org (Postfix) with ESMTPS id F366E42489 for ; Tue, 3 Jan 2023 05:51:59 +1000 (AEST) Received: by mail-ej1-f51.google.com with SMTP id kw15so68662564ejc.10 for ; Mon, 02 Jan 2023 11:51:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=fyup1u38LVqZJywUxO9Vq6GYQh6P0UydpZhU2kaB/hU=; b=wzzVBcvygZRBNGDafjhUtHt9JT2ZYTJz0nItHwM+XG5xRjkt+5WvsE1K0ATgXYYYWV 1SafNR5LFqfbkMixR+VFCXUkbYpVjX2BejxkeVor8ZUpGpmZRSmB/HU5JYaXAdg9u+7R hsp+w3mSRB/7gXUihT7HMV2Hs1nj6L5D/+KI01i1Ry1/usr/gs08BQ7dUa2tL3VE1id9 buXmA6s0l1aGJ7uBaoBChotxFpbwxPF2SnCxGz6izBvsEhqpLTgbFfyEX8nSsjwuu7eZ Hb5OcoA4T2ENjcp3tinBZi+fsOcjro7KRLRUqqBrjVE7q2vf5h8pL/uwJ+71aABGO2UI 5zuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=fyup1u38LVqZJywUxO9Vq6GYQh6P0UydpZhU2kaB/hU=; b=dj++VWWe/cawgoGNV8Xgt6OK4g8Ss8wkzp9wuuox410jVbbaqWt3iJqKK1xUGcpYt9 1Vtg44/531ZYXq1qqK4RGDYCGKqDsMnf2esBduuUZCV0RduIQPLVcypAXsPlR4VeJ5wU 5XTtRZgd6wFTxMmeXCR57L0XwyIbXSGjPYaFusfdAr89FdTpKgMkxDLKEKdwetEeczqo zGCEf+2wXd7bKZHdQTKWgFa/33Lij7S7thOyd8JBceGcJomp+cJYtmWKVSnl6NBb/ZSV abE4lQpFA0/Km1LATDdB9aPhhNDiLKfS5m3roRwAXLVWlwgMGsHH7tIrErR+FanTV6WI uMTg== X-Gm-Message-State: AFqh2kqljhZgdIOkfS/USviB6NcMOarEyhX/+zkY9nUJ4Zwu5cqeQL5H IBtVfXG74U5q4TVn0T3/XnBlYETN6k8gs9A2esjkhA== X-Google-Smtp-Source: AMrXdXtXJFXojF2FCdrxhh/MQXO0Ho8zMtiKpWtOZDXnCkYfh8jrumPWQvlBJL14z2m1tXeG508jl3A5PxNCfqLXTpo= X-Received: by 2002:a17:906:9f1a:b0:7c1:535:f2fb with SMTP id fy26-20020a1709069f1a00b007c10535f2fbmr3437533ejc.252.1672689058390; Mon, 02 Jan 2023 11:50:58 -0800 (PST) MIME-Version: 1.0 References: <88f83b4c-b3f9-ed87-b2fa-560fb369742a@makerlisp.com> <20221231035931.GG5825@mcvoy.com> <528f0c53-ccc2-88a1-5a7b-120362c648dd@mhorton.net> <20230102165120.GK25547@mcvoy.com> <20230102174304.GM25547@mcvoy.com> <59004a29-5119-9dd9-c248-518b8c4e7928@makerlisp.com> <20230102180020.p6gmiwhrnidfbfsc@illithid> <20230102181242.GO25547@mcvoy.com> In-Reply-To: From: Warner Losh Date: Mon, 2 Jan 2023 12:50:47 -0700 Message-ID: To: Clem Cole Content-Type: multipart/alternative; boundary="00000000000025358505f14d45f4" Message-ID-Hash: M54GO3IZCG7BLQEEEPJY5SCP6DGY7CEK X-Message-ID-Hash: M54GO3IZCG7BLQEEEPJY5SCP6DGY7CEK X-MailFrom: wlosh@bsdimp.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 CC: The Eunuchs Hysterical Society 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: --00000000000025358505f14d45f4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jan 2, 2023, 11:18 AM Clem Cole wrote: > > > On Mon, Jan 2, 2023 at 1:13 PM Larry McVoy wrote: > >> >> My scripts worked with /bin/sh being whatever it was. >> >> It's interesting to me that other old timers, like Clem, are saying >> exactly the same thing as I am. Are we all wrong? >> > Exactly -- if you are disciplined -- it just works. It's not magic. > I've only got 30 years experience in writing portable shell scripts... But I have a slightly different take. There is an element of luck involved. There are a number of constructs that are valid in v7 shell that aren't completely portable due to bugs in vendor shells. The luck part comes in either you know what to avoid because you got unlucky and got burned in the past. Or you got lucky and never thought to write something like that so it just works. With experience, you know what works... I notice the old timers hedged a little bit by saying things like "virtually all" so maybe they had a bit of bad luck now and again... Also, the really aweful systems are rare enough today that most folks on this list have had the good luck not to need to run on them... :) You can get super close though, but I'll bet there's some scripts that work only because they didn't run on, say, Eunice... But luck favors the prepared... and making the effort to try to be portable will help when you have to run on dash, or one of the BSD shells that might not have $<(cmd) or some other useful but not universal feature... Warner > =E1=90=A7 > --00000000000025358505f14d45f4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Mon, Jan 2, 2023, 11:18 AM Clem Cole <clemc@ccc.com> wrote:


<= div class=3D"gmail_quote">
On Mon, Jan= 2, 2023 at 1:13 PM Larry McVoy <lm@mcvoy.com> wrote:

My scripts worked with /bin/sh being whatever it was.

It's interesting to me that other old timers, like Clem, are saying
exactly the same thing as I am.=C2=A0 Are we all wrong?
Exactly -- if you are disciplined -- it just works.=C2=A0 It's no= t magic.=C2=A0

I've only got 30 years experience in= writing portable shell scripts... But I have a slightly different take. Th= ere is an element of luck involved. There are a number of constructs that a= re valid in v7 shell that aren't completely portable due to bugs in ven= dor shells. The luck part comes in either you know what to avoid because yo= u got unlucky and got burned in the past. Or you got lucky and never though= t to write something like that so it just works. With experience, you know = what works...

I notice t= he old timers hedged a little bit by saying things like "virtually all= " so maybe they had a bit of bad luck now and again...

Also, the really aweful systems are r= are enough today that most folks on this list have had the good luck not to= need to run on them... :)

You can get super close though, but I'll bet there's some script= s that work only because they didn't run on, say, Eunice...

But luck favors the prepared... and= making the effort to try to be portable will help when you have to run on = dash, or one of the BSD shells that might not have $<(cmd) or some other= useful but not universal feature...

Warner
3D""=E1=90=A7
--00000000000025358505f14d45f4--