-1

What is the difference between shell builtins (like cd or echo) and shell keyboard shortcuts (like ctrl+u or ctrl+l)?

Both seems to me "builtins", what is the major difference by means of system architecture?

I personally use Bash but I believe this question is relevant for many other sh shells.

Arcticooling
  • 1
  • 12
  • 44
  • 103

1 Answers1

1

Most builtins change the status / behaviour of the shell ("permanently"). echo and printf are exceptions.

^U and ^L are key bindings. They just handle the input line editing. You could do the same without these functions. They just save time. After executing a command it does not make a difference whether a key binding function was used earlier.

The maybe most obvious difference is that key bindings are not a command which you can run from the command line. You need a builtin (bind) to configure them (shell "state change").

Hauke Laging
  • 88,146
  • 18
  • 125
  • 174
  • @Arcticooling See my edit – Hauke Laging Nov 25 '17 at 01:46
  • Hmm thanks. I thumbed up. Just one more last thing - The first passage was a bit unclear to me `(change the behavior of the shell ("permanently")`. Given all is changeable, generally, so I didn't quite understand what you meant right there. – Arcticooling Nov 25 '17 at 21:40
  • 1
    @Arcticooling E.g. `shopt -s extglob nullglob globstar failglob` changes the way the shell does globbing. This change is in effect until it is changed again with `shopt`. – Hauke Laging Nov 25 '17 at 22:01