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 9d0ebed1 for ; Sat, 8 Feb 2020 23:14:02 +0000 (UTC) Received: by minnie.tuhs.org (Postfix, from userid 112) id 910199CCB9; Sun, 9 Feb 2020 09:14:01 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id C08B99CCAA; Sun, 9 Feb 2020 09:13:42 +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="louQEzej"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 0947F9CCAA; Sun, 9 Feb 2020 09:13:40 +1000 (AEST) Received: from mail-ua1-f44.google.com (mail-ua1-f44.google.com [209.85.222.44]) by minnie.tuhs.org (Postfix) with ESMTPS id 5D8439CCA9 for ; Sun, 9 Feb 2020 09:13:39 +1000 (AEST) Received: by mail-ua1-f44.google.com with SMTP id h32so1191896uah.4 for ; Sat, 08 Feb 2020 15:13:39 -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=zjI7R0V0tbqXVFDXO0fbIMyYFTRctjcnyA1HoW4lb1k=; b=louQEzejv1xG6Sdwvyjf/TDchihfgMTcrMbnJt1bJjKvbGu9LgUxpVeV25iqXY+DOW AV1SjqsHGhI6Lx9TSvhBuUYExoIWJ071iqy/Xi9Cn58Dxo9mxMnsCWyxUIGSYuperpmQ Nb8tbrA5Fxec/43fTPHepTDidMr9rut+U3bS79gCyeaUwuM7Rc/Fd5C8TwjzsVQlonQN f4OPgbHwpiFLxsBYm/gdPhYCv3QerfRO9ZIF2+2Q/JS/zF/yHfmZassaiUgnwxx9H0LL HEuhYa2qGp21ND+5jAiFsylm02K132M9mwuPLpHqLJlH58g4t4xof0NxYXVG2/kpGpqb AavA== 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=zjI7R0V0tbqXVFDXO0fbIMyYFTRctjcnyA1HoW4lb1k=; b=koy/27tabitLoKeivpJU26lViDFDH8UJy6GF63ycPyLLc1BwnlVLktixhdh0mC/FaM 4VuJFEXkFRW3wPTuwWMp6wnrrQeefZjs3j8iNFTL6vntvsWXDBBsNTgDl+fxWGbt18Pf JE5f3azAqp/4O1IDRVnVlSh5cS6+JhEaTwC55cyks0zZS5EZz2f2mH32VuWfiyZg63OY TVfnSxk1sUGpJhNGjXzzaQ8BYNfopcXaV6xC6mjTmZ62MfpVOqEwMwYBgjSltIpZKyjm n6R47bAZOjObZC1eN5/pauXupFYmq5yvieDA7NaJbjgXnste4eFuGebMoCAolDCMdIv0 zSPw== X-Gm-Message-State: APjAAAXrflXkUi+WLmW+ZbGopbuTnyZ3Qs0YUTM2+0UK1rJMEL/XP35R QCYKvHLYhVMsmnvMmHdJxBkcN4SuVtV2dUanzxQ= X-Google-Smtp-Source: APXvYqwL30C2LEiCFCTa8jwGgoxGmmboNN7v0WyaNdlvjNA4o4TbGVptrFGZ2oaaiNcwhhcMBRJEqrU8LEGDj9oNo4g= X-Received: by 2002:ab0:1d03:: with SMTP id j3mr2947887uak.6.1581203618508; Sat, 08 Feb 2020 15:13:38 -0800 (PST) MIME-Version: 1.0 References: <46c41c18-5b44-14e5-1f0a-9272866993da@case.edu> In-Reply-To: From: Rob Pike Date: Sun, 9 Feb 2020 10:13:27 +1100 Message-ID: To: chet.ramey@case.edu Content-Type: multipart/alternative; boundary="000000000000ffb3cf059e18a79a" 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" --000000000000ffb3cf059e18a79a Content-Type: text/plain; charset="UTF-8" Here is rc, which absorbed most of that behavior from the v8 shell: % rc % fn f { echo hi } % whatis f fn f {echo hi} % whatis path path=(. /Users/r/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /usr/local/go/bin /Applications/Keybase.app/Contents/SharedSupport/bin /usr/local/plan9/bin) % rc % # subshell % f hi % On Sun, Feb 9, 2020 at 10:11 AM 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$ > > > 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. > > > 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. > > > -rob > > > > On Sun, Feb 9, 2020 at 10:02 AM Chet Ramey wrote: > >> On 2/8/20 5:54 PM, Rob Pike wrote: >> > Like exportable functions and output that's valid input, so it works >> well >> > with an editable typescript. >> >> Bash has both of those things. >> >> -- >> ``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/ >> > --000000000000ffb3cf059e18a79a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Here is rc, which absorbed most of that behavior from the = v8 shell:

% rc

% fn f { echo hi }

% whatis= f

fn f {echo hi}

% whatis path

path=3D(. /Users/r/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin= /usr/local/go/bin /Applications/Keybase.app/Contents/SharedSupport/bin /us= r/local/plan9/bin)

% rc

% # subshell

% f

hi

%= =C2=A0




=
On Sun, Feb 9, 2020 at 10:11 AM Rob P= ike <robpike@gmail.com> wrot= e:
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$=C2=A0


I added the 'builtin' command, which did lea= ve 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.


How do I g= et bash to print the function as (shell) source code, so I could edit it an= d play with it again? It was the synergy of all this stuff connected seamle= ssly that made it so compelling.


-rob



On Sun, Feb 9, 2020 = at 10:02 AM Chet Ramey <chet.ramey@case.edu> wrote:
On 2/8/20 5:54 PM, Rob Pike wrote:
> Like exportable functions and output that's valid input, so it wor= ks well
> with an editable typescript.

Bash has both of those things.

--
``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/
--000000000000ffb3cf059e18a79a--