3

I write this config file:

# ~/.inputrc
Control-d: "\C-udate +'%F %T'\C-m"

I want to run date command when I type Ctrl-d.
But I cannot override the default behavior(exit).
Thanks for your help.

2

If you do stty -a, you'll notice that Ctrl-D is bound to eof (end of file) for the terminal driver. You would have to unbind it using stty before the Bash binding would have any affect. I wouldn't recommend that you do that. It would be better to choose another keystroke. I use Alt-Shift-D for a similar purpose.

"\eD":"date +%A,\ %B\ %-d,\ %Y,\ %-l:%M:%S\ %p,\ %Z\ \(UTC%z\)"
3

I think that the line discipline trumps readline. Try executing

stty eof undef

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.