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 QNX Neutrino is a link to the Korn shell, ksh. There are other shells available, including small ones that are suitable for situations with limited memory:

Embedded shell.
Fat embedded shell; similar to esh, but with additional builtin commands.
Micro-embedded shell with a subset of esh's functionality.

Here's a brief comparison of the features that the shells support:

Feature uesh esh fesh ksh
Interactive mode Yes Yes Yes Yes
Script files Yes Yes Yes Yes
Redirection Yes Yes Yes Yes
Pipes Yes Yes Yes
Aliases Yes Yes Yes
Filename expansion Yes Yes Yes
Parameter substitution Yes Yes Yes
Compound commands Yes
Command or arithmetic substitution Yes
Command and filename completion Yes
Tilde expansion Yes
Brace expansion Yes
Coprocesses Yes
Functions Yes
emacs interactive command-line editing Yes
Job control Yes

The small shells have fewer builtin commands than ksh has. For more information about these shells, see the Utilities Reference.

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:

  1. The shell breaks the command line into tokens that are delimited by whitespace or by the special characters that the shell processes.
  2. 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.

  3. The shell processes aliases recursively.
  4. The shell does any required substitutions, including parameters, commands, and filenames.
  5. The shell does any redirection.
  6. 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.