After the character-device driver processes what you type, the command line is passed to a command interpreter or shell.
The default shell is sh, which under BlackBerry 10 OS is a link to the Korn shell, ksh .
In general terms, the shell breaks the command line into tokens, parses them, and invokes the program or programs that you asked for. The specific details depend on the shell that you're using; this section describes what ksh does.
As you type, the Korn shell immediately processes the keys that you use to edit the command line, including completing commands and filenames. When you press Enter, the shell processes the command line:
- The shell breaks the command line into tokens that are delimited by whitespace or by the special characters that the shell processes.
- As it forms words, the shell builds commands:
- simple commands, usually programs that you want to run (e.g., less my_file)
- compound commands, including reserved words, grouping constructs, and function definitions
You can also specify multiple commands on the command line.
- The shell processes aliases recursively.
- The shell does any required substitutions, including parameters, commands, and filenames.
- The shell does any redirection.
- The shell matches the remaining commands, in this order: special builtins; functions; regular builtins; executables.
To override the order in which the shell processes the command line, you use quoting to change the meaning of the special characters.
The sections that follow give the briefest descriptions of these steps— ksh is a very powerful command interpreter! For more details, see its entry in the Utilities Reference.
Last modified: 2013-12-21