The default editor mode for bash is Emacs. Even though I am also a vi
editor user, I tend to leave bash at default. (I think your /someword is
actual the vi command)

To search backwards through history in standard bash, type Ctrl-r and
then the search string. Repeated ctrl-r looks further back.

BTW http://www.faqs.org/docs/bashman/bashref_95.html  references other
search functions. But some of these are broken (at least in Cygwin
running bash). I imagine some like Ctrl-s are swallowed by the tty
(Ctrl-s in terminals is normally XOFF - stops scrolling).

(I found this
http://lists.naos.co.nz/pipermail/wellylug/2004-September.txt - search
for "forward-search-history - gives a similar conclusion re Ctrl-s)

  

Martin Visser, CISSP
Network and Security Consultant 
Consulting & Integration
Technology Solutions Group - HP Services

410 Concord Road
Rhodes NSW  2138
Australia 

Mobile: +61-411-254-513
Fax: +61-2-9022-1800     
E-mail: martin.visserAThp.com

This email (including any attachments) is intended only for the use of
the individual or entity named above and may contain information that is
confidential, proprietary or privileged. If you are not the intended
recipient, please notify HP immediately by return email and then delete
the email, destroy any printed copy and do not disclose or use the
information in it.


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: Tuesday, 24 May 2005 11:37 AM
To: [email protected]
Subject: Re: [SLUG] recursive tree log grep ?

Hi

> Run "help" for a list of shell internals to get help on...
> 
> $ help history
> history: history [-c] [-d offset] [n] or history -awrn [filename] or 
> history -ps arg [arg...]
>      Display the history list with line numbers.  Lines listed with
>      with a `*' have been modified.  Argument of N says to list only
>      the last N lines.  The `-c' option causes the history list to be
>      cleared by deleting all of the entries.  The `-d' option deletes
>      the history entry at offset OFFSET.  The `-w' option writes out
the
>      current history to the history file;  `-r' means to read the file
and
>      append the contents to the history list instead.  `-a' means
>      to append history lines from this session to the history file.
>      Argument `-n' means to read all history lines not already read
>      from the history file and append them to the history list.  If
>      FILENAME is given, then that is used as the history file else
>      if $HISTFILE has a value, that is used, else ~/.bash_history.
>      If the -s option is supplied, the non-option ARGs are appended to
>      the history list as a single entry.  The -p option means to
perform
>      history expansion on each ARG and display the result, without
storing
>      anything in the history list.

I love vi, but do not use the vi-command-edit option of bash.
My mate who does asked me how to do this with the standard (emacs) shell
edit functions:

/someword                       # look for a history event starting
'someword'
<up>                            # previous history event starting
'someword'
<cr>                            # execute THAT command

$ history | grep someword
!2-whatever                     # works, but is cumbersome

Any suggestion on how to preview a qualified list of history, and
execute one of them without using the vi options (+o vi).

Yea, I RFM'd the 100 odd pages, and thank heavens for info2html, IMHO
the whole info system is diabolical.

James
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to