> On Oct 29, 2017, at 11:51 AM, Cy Schubert <[email protected]> wrote:
> 
> In message <[email protected]
> om>
> , Warner Losh writes:
>> --94eb2c114c9a7c3c21055cb3566c
>> Content-Type: text/plain; charset="UTF-8"
>> 
>>>> On Sun, Oct 29, 2017 at 8:26 AM, Ed Maste <[email protected]> wrote:
>>>> 
>>>> On 29 October 2017 at 00:53, Eitan Adler <[email protected]> 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
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to