Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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\)"
share|improve this answer

I think that the line discipline trumps readline. Try executing

stty eof undef
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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