On Mon, Jan 4, 2016 at 3:07 PM, Eduardo A. Bustamante López <
dual...@gmail.com> wrote:

> Take into account that many options have been provided (history -d, the
> space
> prefix, even editing .bash_history yourself).
>
> But you request a single key stroke to do this... why?
>
> If you enter a password by mistake in your shell, and it gets recorded,
> then
> you go and clean up. It's not hard to do.
>
> But since you request a simple-and-easy way of doing this, it seems like
> you do
> this a lot... which you shouldn't! :-)
>
> Now, it is up to you to convince Chet that it is so important to have a
> simple
> shortcut to do this. IMO, it isn't.
>
> --
> Eduardo Bustamante
> https://dualbus.me/
>
>

Just bind your own keystroke to a function which uses history -d:

histdel() {
    local last_command histline

    last_command=$(history 1)

    histline="${last_command%  *}"

    history -d "$histline"    #  I wish history -d accepted negative offsets
}

bind -x '"\ez": histdel'

Then Esc-z or Alt-z will delete the most recent history entry. You could
choose another keystroke to bind.


-- 
Visit serverfault.com to get your system administration questions answered.

Reply via email to