Tuesday, July 15, 2008

Ctrl+D or exit: Which one is better?

In BASH, to exit from shell we can use Ctrl+D or exit ? which one is better?

-Ctrl+D conveniently exits Bash
-Sometimes too conveniently bcoz session may be terminated if pressed accidentaly.

To avoid the accidental exit, we can specify the no of "Ctrl+D" pressed before exit.

$export IGNOREEOF=1

$ Ctrl+D
$ Use "exit" to leave the shell.
$ Ctrl+D
$ exit

No comments: