Input and outputīefore a command is executed its input and output may be redirected using a special notation interpreted by the shell. If at any time a newline is typed and further input is needed to complete a command then the secondary prompt ( $PS2) is issued. When used interactively, the shell prompts with the value of $PS1 before reading a command. Inside double quotes ( "") parameter and command substitution occurs and " \" quotes the characters \, ` " and $. All characters enclosed between a pair of quote marks ( ''), except a single quote, are quoted. The following characters have a special meaning to the shell and cause termination of a word unless quoted:Ī character may be quoted by preceding it with a " \".
Matches any character except the enclosed ones. A pair of characters separated by - matches any character lexically between the pair. Matches any one of the characters enclosed. Matches any string, including the null string. at the start of a file name or immediately following a " /", and the character " /", must be matched explicitly. If no file name is found that matches the pattern then the word is left unchanged. The word is replaced with alphabetically sorted file names that match the pattern. If one of these characters appears then the word is regarded as a pattern. File name generationįollowing substitution, each command word is scanned for the characters " *", " ?" and " [". Implicit null arguments (those resulting from parameters that have no values) are removed. Explicit null arguments ( "" or '') are retained. A value of zero means no timeout and is the default.Īfter parameter and command substitution, any results of substitution are scanned for internal field separator characters (those found in $IFS) and split into distinct arguments where such characters are found. The shell exists when prompting for input if no command is entered for more than the given value in seconds. If this variable is set in the initial environment passed to the shell and points to a file writable by the user, accounting statistics are written to it. Internal field separators, normally space, tab, and newline.Īffects the mapping of bytes to characters for file name generation, for the interpretation of ' \', and for handling $IFS. Command substitution using back quotes, e.g.: ` command `.Scripts can be interpreted, i.e., they do not have to be compiled to be executed.Flow control constructs, quotation facilities, and functions.The shell supports input and output redirection, and pipelines.Commands may be executed synchronously or asynchronously.The shell may be used interactively or non-interactively.Scripts can be invoked as commands using their file name.Although it is used as an interactive command interpreter, its original purpose was to function as a scripting language. The Bourne Shell was originally developed as a replacement for the Thompson shell, whose executable file was also named sh. Most Unix-like systems contain the file /bin/sh that is either the Bourne shell, or a symbolic link (or hard link) to a compatible shell. It was the default shell of Unix Version 7. The Bourne shell was developed in 1977 by Stephen Bourne at AT&T's Bell Labs in 1977.
Sh is a command language interpreter that executes commands read from a command line string, the standard input, or a specified file.