1

I know how to disable ctrl-D by set -o ignoreeof, which applies when logged in over ssh as well.. But I only want to disable it when it is about to quit a local shell. How can I then?

In interactive bash shell, ctrl-d is used to delete characters in front, and to indicate the end of stdin input, and also makes bash quit.

Sometimes when I delete characters in front by ctrl-d, I hold the keys too long, and accidentally make bash quit. How can I prevent accidentally making bash quit?

  • "The linked duplicate post disables ctrl-D as eof unanimously"—that's very strange, set -o ignoreeof is not supposed to affect stdin input or character deletion. – undercat Feb 16 at 14:00
  • @undercat: you are correct. Sorry. I changed to how to not allow it to quit ssh remote shell. – Tim Feb 16 at 14:59
  • The question has now been edited into its own answer. I know that ignoreeofis the way to do this. How do I do this? – JdeBP Feb 16 at 19:10
  • @JdeBP As I understand it, the question is in the sentences which follow what you quote. The OP wants to disable ctrl-D for the local shell while keeping it enabled for ssh. – John1024 Feb 17 at 1:07
2

If you want to delete all characters on the line, try Ctrl-K instead.

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.