3

Pressing Ctrl+R and typing py results in:

(reverse-i-search) `py´: python

I would like it to be this way:

(reverse-i-search) `py´: n python

where n is the history line number. I did not find an option in man bash (and wasn't surprised to find nothing, since it is a bit specific). Is there a way to achieve this by only editing the .bashrc?

3
  • 1
    Whats the use case? How about duplicate entries? Commented Apr 1, 2015 at 11:42
  • Isn't the point of searching when one doesn't know number?
    – bsd
    Commented Apr 1, 2015 at 11:56
  • When reverse-searching, i find it helpful to know how far back i am currently. It would only be there to give me an estimate of how far back it is.
    – JHK
    Commented Apr 1, 2015 at 15:26

1 Answer 1

1

If there was an option to control the format of what you see during a history i-search, it would be documented in the man page. Since you didn't find such an entry, there probably isn't one.

It would probably be implemented as a shopt toggle setting, or as PS6 or something for a format string.

I agree this would be a neat UI feature, to help you know what you'll find if you up/down arrow from that point in history.

You should email the suggestion to [email protected]. See https://www.gnu.org/software/bash/.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .