3 ms·
> Among these 4 shortcuts, there is one that is implemented differently from the others, which one is it? Ctrl-A vs Ctrl-E vs Ctrl-W vs up arrow. The correct
by ksherlock 4y ago
> Among these 4 shortcuts, there is one that is implemented differently from the others, which one is it?
Ctrl-A vs Ctrl-E vs Ctrl-W vs up arrow. The correct answer is the up arrow and any interviewer who disagrees will walk out of the room with a broken nose. Bash, readline, etc, operate in raw mode so the tty driver isn't handling anything. Three are control characters - a single character. Meanwhile, a vt100 can generate 2 different sequences for the up arrow -- ESC [ A or ESC O A -- depending on cursor key mode. Either way, that's 3 characters instead 1 character. (There's also a third sequence -- ESC A -- in vt52 mode but we'll ignore that).