Monday, July 30, 2018

Re: Keeping clear out of history

Ken M wrote:
># I wish this worked
># bind -m '^L'=clear'^J';sed -i '$d' $HISTFILE

You need to make sure that the sed command is inside the argument of bind.
Something like this:

bind -m '^L=^Uclear;sed -i \$d "$HISTFILE"^J^Y'

The ^Y is just there to paste back the current line content when you press
^L in the middle of an existing line; the double quotes are there in case
$HISTFILE contains a space.

Note that, even if you change $HISTFILE, the clear command will still
appear in ksh's history when you press the up arrow, so I'm not sure what
you are trying to do is worth the trouble.

Cheers,

Philippe

No comments:

Post a Comment