svn commit: r325092 - head/usr.bin/fortune/datfiles

Devin Teske devin at shxd.cx
Sun Oct 29 19:48:01 UTC 2017


> On Oct 29, 2017, at 11:51 AM, Cy Schubert <Cy.Schubert at komquats.com> wrote:
> 
> In message <CANCZdfrE1oHqoTFFagVz3xHbK-oiFrPy3+rtF2cOjpzu=evhQg at mail.gmail.c
> om>
> , Warner Losh writes:
>> --94eb2c114c9a7c3c21055cb3566c
>> Content-Type: text/plain; charset="UTF-8"
>> 
>>>> On Sun, Oct 29, 2017 at 8:26 AM, Ed Maste <emaste at freebsd.org> wrote:
>>>> 
>>>> On 29 October 2017 at 00:53, Eitan Adler <eadler at freebsd.org> wrote:
>>>> Author: eadler
>>>> Date: Sun Oct 29 04:53:33 2017
>>>> New Revision: 325092
>>>> URL: https://svnweb.freebsd.org/changeset/base/325092
>>>> 
>>>> Log:
>>>> Modernize freebsd-tips a bit
>>> ...
>>>> %
>>>> Want to run the same command again?
>>>> -In tcsh you can type "!!".
>>>> +Type "!!".
>>>> %
>>> 
>>> $ !!
>>> sh: !!: not found
>>> 
>>> I doubt many people use /bin/sh as an interactive shell, but the tip
>>> ought not lead those who do astray
>> 
>> Yes. /bin/sh on FreeBSD doesn't grok it, though bash and some other shells
>> available as ports do. I think that the old text was a bit better.
> 
> Or better yet, ctrl-r in bash and zsh, or up-arrow in tcsh.

Since we are responding to emaste's astute observation with random personal favorites when it comes to history actions in an interactive shell...

How about Esc-P and Esc-N?

Never used it, you say? Few people do.

Try this:

Esc-P
(a colon appears)
(type a portion of the event you are looking for and press ENTER)
Found it? Good.
Didn't find it? Esc-P then ENTER to repeat search further back.
Keep typing Esc-P, ENTER until you find it.
Oh, you went too far? Esc-N, ENTER to search forward from the last matched event.

Sometimes I show this to co-workers and they shake their head and go back to Ctrl-R.

Ctrl-R is ok, but doesn't enable an Esc-N-like functionality by default. But if you execute (or put in your shell profile) "stty -ixon" then you can use Ctrl-S to reverse the search order during a Ctrl-R search.

For example:

Ctrl-r
(a prompt appears)
(type some text; don't hit ENTER)
Ctrl-r until you find the one you want
Went too far?
Ctrl-s to switch from reverse-search to forward-search
Ctrl-s until you find one you want

Just thought I would share this random info.

As for the fortune statement...

I agree with emaste, "Type !!" is misleading. Old statement of "in tcsh you can type !!" was fine because tcsh is the only shell in base that supports that feature. However, possible alternatives to "Type !!" could be:

Try "!!" (works in many shells but not all).

NB: Trying to make a future-proof statement so the fortune datfile doesn't have to be onerously maintained.
-- 
Devin


More information about the svn-src-all mailing list