I try to define a custom behaviour of the backward-kill-word function in bash xterm.
For that, I need to catch the command line before validate it.
For instances, if I type sdcds/edfdD sdf/sdf without typing enter, I want by using a shortcut like esc + backspace to catch the line sdcds/edfdD sdf/sdf in a temporary variable to apply a sed after.
I have already written the sed and the bind command but I cannot find anywhere how to catch the buffer command line.
Update from Answer
Ok thanks a lot, I think I'm not clear enough in my explanation. What I want to do is to create a function and the related bind key in the bash.rc to modify the text in the command line. Imagine, I want to define a function which removes the command line (before typing enter) till "/" for example and only till /, I could write in my .bash.rc :
function backward-delete-to-slash () { echo $BUFFER_COMMAND_LINE | sed 's:(.[/][/]).*:\1:';}
bind -x '"\e\d": backward-delete-to-slash'
My problem is to catch the command line into a $BUFFER_COMMAND_LINE variable. If I had this variable, I could do for instance :
$: sdffs/dsfd dsfsdf/dfdsf (without typing enter)
esc + backspace
$: sdffs/dsfd dsfsdf/
So I hope to be more exhaustive.