bash : alt-p history recall like in csh - Linux

This is a discussion on bash : alt-p history recall like in csh - Linux ; Hi In csh there is something very convenient : alt-p , that recall previous history commands starting with the beginning of the current command line. In bash there is control-R but it looks for every command that *contains* the word ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: bash : alt-p history recall like in csh

  1. bash : alt-p history recall like in csh

    Hi
    In csh there is something very convenient : alt-p , that recall
    previous history commands starting with the beginning of the current
    command line.
    In bash there is control-R but it looks for every command that
    *contains* the word you type, and not *start with*

    So my questions are :
    - how to specify to control-R that we want the commands that start
    with the input
    - how to make bash start a script if I press alt-p (this script would
    grep the history file)

    Thanks for considering my question

    Eric

  2. Re: bash : alt-p history recall like in csh

    hi

    > Raz' wrote:
    > Hi
    > In csh there is something very convenient : alt-p , that recall
    > previous history commands starting with the beginning of the current
    > command line.
    > In bash there is control-R but it looks for every command that
    > *contains* the word you type, and not *start with*
    >
    > So my questions are :
    > - how to specify to control-R that we want the commands that start
    > with the input
    > - how to make bash start a script if I press alt-p (this script would
    > grep the history file)
    >


    'fc -s cc' will reexecute the last command beginning with cc :-)


    --
    good luck

    peter

  3. Re: bash : alt-p history recall like in csh

    Peter Volsted wrote:
    > hi
    >
    > > Raz' wrote:

    >
    >> Hi
    >> In csh there is something very convenient : alt-p , that recall
    >> previous history commands starting with the beginning of the current
    >> command line.
    >> In bash there is control-R but it looks for every command that
    >> *contains* the word you type, and not *start with*
    >>
    >> So my questions are :
    >> - how to specify to control-R that we want the commands that start
    >> with the input
    >> - how to make bash start a script if I press alt-p (this script would
    >> grep the history file)
    >>

    >
    > 'fc -s cc' will reexecute the last command beginning with cc :-)
    >
    >


    So will '!cc', I believe

  4. Re: bash : alt-p history recall like in csh

    I have patches for bash at
    ftp://ftp.newspapersystems.com/pub/binaries/patches/ that make ^R do an
    incremental search starting with the text that you have already typed.
    For example, if you just ran "cc test.c", you could type ^Rte to
    find the command and run it.
    William


+ Reply to Thread