• Bash reverse-i-search oddity

    From Ottavio Caruso@21:1/5 to All on Thu Aug 10 11:39:42 2023
    I have two files in two locations:

    $ grep housing .bash_history |sort |uniq
    vim Tenancy-Feb-2021/housing-log.txt
    vim Tenancy-Jul-2023/housing.txt


    As you can see, both are in the history file.

    However if I do:

    "CTRL-R hous"

    this will only find "Tenancy-Feb-2021/housing-log.txt" but not "Tenancy-Jul-2023/housing.txt"

    This has been happening since I created the latter file "Tenancy-Jul-2023/housing.txt".

    Odd, isn't it?



    --
    Ottavio Caruso

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Keith Thompson@21:1/5 to Ottavio Caruso on Thu Aug 10 12:38:00 2023
    Ottavio Caruso <ottavio2006-usenet2012@yahoo.com> writes:
    I have two files in two locations:

    $ grep housing .bash_history |sort |uniq
    vim Tenancy-Feb-2021/housing-log.txt
    vim Tenancy-Jul-2023/housing.txt


    As you can see, both are in the history file.

    However if I do:

    "CTRL-R hous"

    this will only find "Tenancy-Feb-2021/housing-log.txt" but not "Tenancy-Jul-2023/housing.txt"

    This has been happening since I created the latter file "Tenancy-Jul-2023/housing.txt".

    Odd, isn't it?

    I can't reproduce it on my system (Ubuntu, bash 5.2.0(11)-release).

    Does "history | grep housing | sort | uniq" show both commands? Perhaps
    your shell's internal history doesn't match the contents of the
    .bash_history file. Is $HISTFILE set correctly?

    (BTW, "sort | uniq" can be replaced by "sort -u".)

    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Will write code for food.
    void Void(void) { Void(); } /* The recursive call of the void */

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to Ottavio Caruso on Thu Aug 10 20:16:19 2023
    Ottavio Caruso <ottavio2006-usenet2012@yahoo.com> writes:

    I have two files in two locations:

    $ grep housing .bash_history |sort |uniq
    vim Tenancy-Feb-2021/housing-log.txt
    vim Tenancy-Jul-2023/housing.txt

    This hides some information that might be useful such as the order of
    the commands.

    As you can see, both are in the history file.

    However if I do:

    "CTRL-R hous"

    this will only find "Tenancy-Feb-2021/housing-log.txt" but not "Tenancy-Jul-2023/housing.txt"

    You mean that it finds "vim Tenancy-Feb-2021/housing-log.txt"?
    I.e. that this line shows up:

    (reverse-i-search)`hous': vim Tenancy-Feb-2021/housing-log.txt

    And by not finding the other you mean that an immediate second Ctrl^R
    press causes the above line to change to

    (failed reverse-i-search)`hous': vim Tenancy-Feb-2021/housing-log.txt

    immediately?

    This has been happening since I created the latter file "Tenancy-Jul-2023/housing.txt".

    Odd, isn't it?

    Yes, that is odd.

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Roger@21:1/5 to ottavio2006-usenet2012@yahoo.com on Tue Aug 15 11:47:23 2023
    On Thu, 10 Aug 2023 11:39:42 +0000, Ottavio Caruso <ottavio2006-usenet2012@yahoo.com> wrote:

    I have two files in two locations:

    $ grep housing .bash_history |sort |uniq
    vim Tenancy-Feb-2021/housing-log.txt
    vim Tenancy-Jul-2023/housing.txt


    As you can see, both are in the history file.

    However if I do:

    "CTRL-R hous"

    this will only find "Tenancy-Feb-2021/housing-log.txt" but not >"Tenancy-Jul-2023/housing.txt"

    This has been happening since I created the latter file >"Tenancy-Jul-2023/housing.txt".

    Odd, isn't it?

    Odd? Yes. Try:

    "CTRL-R vim T"

    repeated CTRL-R will get you all instances in history which
    begin "vim T". Is that any use to you?
    --
    Roger

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)