From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from minnie.tuhs.org (minnie.tuhs.org [45.79.103.53]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 16dc55e7 for ; Sat, 8 Feb 2020 23:29:50 +0000 (UTC) Received: by minnie.tuhs.org (Postfix, from userid 112) id E8E579CCC7; Sun, 9 Feb 2020 09:29:48 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 3E1109CCAE; Sun, 9 Feb 2020 09:29:19 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nsamoWhJ"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 3D8809CCAE; Sun, 9 Feb 2020 09:29:17 +1000 (AEST) Received: from mail-vs1-f51.google.com (mail-vs1-f51.google.com [209.85.217.51]) by minnie.tuhs.org (Postfix) with ESMTPS id 57A6E9CCA9 for ; Sun, 9 Feb 2020 09:29:14 +1000 (AEST) Received: by mail-vs1-f51.google.com with SMTP id x123so1918529vsc.2 for ; Sat, 08 Feb 2020 15:29:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=d2k99oD94WuDsv521VkRbcCxuLnVI2RheYyU9sk9Lz8=; b=nsamoWhJK028JKqawLnIRI3/6sG3qUDdVK+WIWS+t8DePw6YicNHGEZF6uD7W5GvSR 2uAWiVeZJ6JcKPDf9gm4L6DuzB9SL2fbXfKj9SpI76b09VMvZwMz16sdEyviF5Xx6O7B z7SuzjmjKQZ/8oNiUj+dZLkqzjpo+Hoh5bqXtPZsGnACeWWPVAaEhdvWHGtIJwleV9Lx HB6BlrSIlKJsr6Ju1kXFy20nvoXA62YCDHh1gYjuiiVXi/c/onttggaUl2hNMTjp8/yn /nrsUbTyxSzDA8tPcxUOpk73D21bgzgTCswnOMSBW6HC0SKsqqTizxxzHpG84/CiPKqs 5TKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=d2k99oD94WuDsv521VkRbcCxuLnVI2RheYyU9sk9Lz8=; b=IUaLonN7jhdn9MCrUS4PaYVBwZ8pE3bYWmQFZ0jGDylpA9yxZCt9JX/bCBanYknlIp fAUFWmKx8Cf9ulyXrm7VvTq9m9hDtBEnanZELf/xrh7AEVfmn3vVRk1Jzs8EYGnylC40 VjkqKju76nxGj+o2rykISG6/A458iWDjy27EUW7XvVV82+Ldh0AiQNeReeqGuzCk3NS4 VLj93KIzX44SCw+RjeAxHbczc6rVRmoy/EIRVrM97XiwjMDTEZ8Hj5oVWPTngfo5UrBt N6oBi5BHrhq+8u5smBjGmnQuYCF6ruASXf/IBzxoYxr3pwSzQy0kc7yCaiKRjlKE5i+7 WLYg== X-Gm-Message-State: APjAAAVBDEeXyldyEqxlTt1HDjAe8HX0sq+Nevq21PTmiBcf88VlEn9+ yyFFVnDTlg/Y2XtPZ0nVVyLSnRMAEMni8wb8N4w= X-Google-Smtp-Source: APXvYqyMb1oZMalRL0VqjrJED98Dv4Ity20iE2XaOpHh24VlZeMGlUFSGuYfUg6oxIomdhCGRj1n1i73uuHoUNuRLPA= X-Received: by 2002:a67:b303:: with SMTP id a3mr2844204vsm.141.1581204553471; Sat, 08 Feb 2020 15:29:13 -0800 (PST) MIME-Version: 1.0 References: <46c41c18-5b44-14e5-1f0a-9272866993da@case.edu> <62548c3e-4692-c2d3-f06f-745353490b95@case.edu> In-Reply-To: <62548c3e-4692-c2d3-f06f-745353490b95@case.edu> From: Rob Pike Date: Sun, 9 Feb 2020 10:29:02 +1100 Message-ID: To: chet.ramey@case.edu Content-Type: multipart/alternative; boundary="000000000000ba1b35059e18df57" Subject: Re: [TUHS] Warner's Early Unix Presentation X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: The Eunuchs Hysterical Society Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" --000000000000ba1b35059e18df57 Content-Type: text/plain; charset="UTF-8" % rc % whatis cd builtin cd % It's much simpler this way. The output is the executable input, free of decoration and ready to use. In today's Unix (I use the term loosely) world, the phrase "free of decoration" is apostasy. -rob On Sun, Feb 9, 2020 at 10:26 AM Chet Ramey wrote: > On 2/8/20 6:11 PM, Rob Pike wrote: > > Not for me it doesn't. > > > > % bash > > > > bash-3.2$ function f() { > > > > echo hi > > > > } > > > > bash-3.2$ export f > > bash-3.2$ bash > > bash-3.2$ f > > bash-3.2$ > > jenna(1)$ echo $BASH_VERSION > 5.0.11(6)-release > jenna(1)$ f() { echo f; } > jenna(1)$ export -f f > jenna(1)$ bash > jenna(2)$ f > f > jenna(2)$ > > It works the same in Mac OS X's bash-3.2. > > > I added the 'builtin' command, which did leave the labs. But I added it > as > > a way for the "whatis" command to show a builtin, as well as allowing a > way > > to guarantee you get the builtin on execution. > > Bash uses `type' to tell whether something is a builtin. How does `builtin' > say whether or not a command is builtin? The output with no arguments? > > > How do I get bash to print the function as (shell) source code, so I > could > > edit it and play with it again? It was the synergy of all this stuff > > connected seamlessly that made it so compelling. > > > > jenna(2)$ declare -pf f > f () > { > echo f > } > declare -fx f > > If it weren't exported, you wouldn't get the `declare' command appended > there. > > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/ > --000000000000ba1b35059e18df57 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

% r= c

% w= hatis cd

bui= ltin cd

%=C2=A0


It's much simpler this way. The output is the execu= table input, free of decoration and ready to use.


In today's Unix (I use the term loosely) world, the = phrase "free of decoration" is apostasy.=C2=A0

<= p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-v= ariant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:nor= mal;color:rgb(0,0,0)">

-rob



On Sun, Feb 9, 2020 at 10:26 AM Chet Ram= ey <chet.ramey@case.edu> w= rote:
On 2/8/20 = 6:11 PM, Rob Pike wrote:
> Not for me it doesn't.
>
> % bash
>
> bash-3.2$ function f() {
>
> =C2=A0 =C2=A0 echo hi
>
> =C2=A0 =C2=A0 }
>
> bash-3.2$ export f
> bash-3.2$ bash
> bash-3.2$ f
> bash-3.2$

jenna(1)$ echo $BASH_VERSION
5.0.11(6)-release
jenna(1)$ f() { echo f; }
jenna(1)$ export -f f
jenna(1)$ bash
jenna(2)$ f
f
jenna(2)$

It works the same in Mac OS X's bash-3.2.

> I added the 'builtin' command, which did leave the labs. But I= added it as
> a way for the "whatis" command to show a builtin, as well as= allowing a way
> to guarantee you get the builtin on execution.

Bash uses `type' to tell whether something is a builtin. How does `buil= tin'
say whether or not a command is builtin? The output with no arguments?

> How do I get bash to print the function as (shell) source code, so I c= ould
> edit it and play with it again? It was the synergy of all this stuff > connected seamlessly that made it so compelling.
>

jenna(2)$ declare -pf f
f ()
{
=C2=A0 =C2=A0 echo f
}
declare -fx f

If it weren't exported, you wouldn't get the `declare' command = appended
there.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0``Ars longa, = vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU=C2=A0 =C2=A0 chet@case.edu=C2=A0 =C2=A0 http://tiswww.cwru.edu/~che= t/
--000000000000ba1b35059e18df57--