Reputation: 14264
I'd like to unbind C-d from sending EOF in bash, and set it to another key. The idea is to keep C-d as EOF in my .bashrc
, but to rebind it in my .bash_profile
, so that hitting C-d repeatedly with pull me out of any subshells I'm in, but leave me in my login shell.
Is this possible? C-d seems to be bound to delete-char
, which it performs if there's text on the current line. It only sends EOF if there's no text on the current line. Rebinding delete-char
to, say, C-f applies the delete-char
action, but not the EOF sending.
Does Readline offer a way to rebind the EOF command?
Upvotes: 3
Views: 345
Reputation: 43497
No, but stty eof
will allow you to change the EOF character. And it's a really bad idea to do so.
Upvotes: 2
Reputation: 360143
The behavior you're talking about is set by stty
. Why don't you bind another keystroke to either emit C-d or nothing depending on whether you're in a login shell or a non-login shell and use that?
Upvotes: 2