[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: can't just hold down ^K to clean up history

From: Chris Down
Subject: Re: can't just hold down ^K to clean up history
Date: Wed, 16 Oct 2013 21:51:47 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

On 2013-10-16 20:53, address@hidden wrote:
> Let's say one accidentally pastes a many lines of some email into a bash
> window.

Firstly: you should be careful not to do that.

> Yes bash tries to execute each line. Can't blame it.

Well, it's the expected behaviour. Bash doesn't know the difference between
what you paste, and what you input explicitly (with the exception of if your
terminal support bracketed paste, but I only know of zsh implementations of
that functionality).

> But now we are faced with cleaning the mess out of history.
> We use ^P^P^P^P^P^P^P... to finally get to the top of the mess.
> Then we must use ^K^N^K^N^K^N^K^N^K^N^K^N... to clean it up.
> However this leaves many blank lines in history!

You just blanked the lines, you didn't delete them.

> Also why can't we just hold down ^K^K^K^K^K^K^K^K^K ?

Why do you expect to be able to do that? C-k in readline deletes to the end of
the current line. There's no reason why it should also get the next line.

If you want to do this:

    history -a
    "$EDITOR" "$HISTFILE"  # go fix it
    history -c
    history -r

Attachment: pgppKilD281Tj.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]