The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Warner Losh <imp@bsdimp.com>
To: Rob Pike <robpike@gmail.com>
Cc: The Eunuchs Hysterical Society <tuhs@tuhs.org>
Subject: Re: [TUHS] Warner's Early Unix Presentation
Date: Sat, 8 Feb 2020 16:35:18 -0700	[thread overview]
Message-ID: <CANCZdfppr+ywYUsadw67bni1oEBEM7FJivPPxKWYDx5tez9pjQ@mail.gmail.com> (raw)
In-Reply-To: <CAKzdPgxZXp24KK5D06x1sgh3HS5xZqxbDwY5N7SipDaoBvX0LQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1983 bytes --]

On Sat, Feb 8, 2020, 4:29 PM Rob Pike <robpike@gmail.com> wrote:

> % 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.
>

A number of utilities have a special flag to use in shell scripts to remove
the decorations. I both like and loath this design pattern.

Warner

-rob
>
>
>
> On Sun, Feb 9, 2020 at 10:26 AM Chet Ramey <chet.ramey@case.edu> 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/
>>
>

[-- Attachment #2: Type: text/html, Size: 5941 bytes --]

  reply	other threads:[~2020-02-08 23:36 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-07 22:25 Warren Toomey
2020-02-07 23:57 ` Rob Pike
2020-02-08  0:43   ` Warren Toomey
2020-02-08  3:37     ` Warner Losh
2020-02-08 15:15   ` Warner Losh
2020-02-08 21:50     ` Rob Pike
2020-02-08 22:29       ` Chet Ramey
2020-02-08 22:54         ` Rob Pike
2020-02-08 23:02           ` Chet Ramey
2020-02-08 23:11             ` Rob Pike
2020-02-08 23:13               ` Rob Pike
2020-02-08 23:21               ` Kurt H Maier
2020-02-08 23:26                 ` Rob Pike
2020-02-08 23:28                   ` Chet Ramey
2020-02-08 23:26               ` Chet Ramey
2020-02-08 23:29                 ` Rob Pike
2020-02-08 23:35                   ` Warner Losh [this message]
2020-02-08 23:36                   ` Chet Ramey
2020-02-08 23:54                     ` Rob Pike
2020-02-09  0:11                       ` Chet Ramey
2020-02-09  0:19                   ` Larry McVoy
2020-02-08 22:31       ` Richard Salz
2020-02-10 13:18       ` Tony Finch
2020-02-10 15:05       ` Dan Cross
2020-02-10 15:46         ` [TUHS] V9 shell [was Re: Warner's Early Unix Presentation] arnold
2020-02-10 18:39           ` Rob Pike
2020-02-10 18:59             ` Bakul Shah
2020-02-10 19:58             ` Angelo Papenhoff
2020-02-10 20:11               ` Chet Ramey
2020-02-11  9:33             ` arnold
2020-02-11  9:47               ` Noel Hunt
2020-02-11  9:47               ` Rob Pike
2020-02-11  9:59                 ` Rob Pike
2020-02-11 17:05                   ` Steffen Nurpmeso
2020-02-11 17:18                     ` Arthur Krewat
2020-02-11 18:22                     ` Kurt H Maier
2020-02-16 21:34                       ` Wesley Parish
2020-02-11 18:26                     ` Jon Steinhart
2020-02-11 23:56                       ` Steffen Nurpmeso
2020-02-12  0:12                         ` Jon Steinhart
2020-02-12  1:03                           ` [TUHS] V9 shell Warren Toomey
2020-02-12  5:54                           ` [TUHS] V9 shell [was Re: Warner's Early Unix Presentation] Rob Pike
2020-02-11 17:36                   ` Dan Cross
2020-02-11 18:35                   ` Christopher Browne
2020-02-11 18:54                     ` Rob Pike
2020-02-11 21:36                     ` Harald Arnesen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANCZdfppr+ywYUsadw67bni1oEBEM7FJivPPxKWYDx5tez9pjQ@mail.gmail.com \
    --to=imp@bsdimp.com \
    --cc=robpike@gmail.com \
    --cc=tuhs@tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).