9srv Manual Collection/plan9/rc(1) | 9srv Manual Collection/plan9/rc(1) |
---|
A long command line may be continued on subsequent lines by typing a backslash (\) followed by a newline. This sequence is treated as though it were a blank. Backslash is not otherwise a special character.
A number-sign (#) and any following characters up to (but not including) the next newline are ignored, except in quotation marks.
The first word of a simple command cannot be a keyword unless it is
quoted or otherwise disguised.
The keywords are
The simplest kind of argument is the unquoted word:
a sequence of one or more characters none of which is a blank, tab,
newline, or any of the following:
A quoted word is a sequence of characters surrounded by single quotes ('). A single quote is represented in a quoted word by a pair of quotes ('').
Each of the following is an argument.
is equivalent to
Redirections may be applied to a file-descriptor other than standard input or output by qualifying the redirection operator with a number in square brackets. For example, the diagnostic output (file descriptor 2) may be redirected by writing cc junk.c >[2]junk.
A file descriptor may be redirected to an already open descriptor by writing >[fd0=fd1], <>[fd0=fd1], or <[fd0=fd1]. Fd1 is a previously opened file descriptor and fd0 becomes a new copy (in the sense of dup(2)) of it. A file descriptor may be closed by writing >[fd0=] or <[fd0=].
Redirections are executed from left to right. Therefore, cc junk.c >/dev/null >[2=1] and cc junk.c >[2=1] >/dev/null have different effects: the first puts standard output in /dev/null and then puts diagnostic output in the same place, where the second directs diagnostic output to the terminal and sends standard output to /dev/null.
newconn <>/net/tcp/clone >[1=0] opens /net/tcp/clone exactly once for reading and writing and puts it on standard input and output. lpd <>[3]/net/tcp/42/data opens /net/tcp/42/data exactly once for reading and writing and puts it on file descriptor 3.
A pair of commands separated by && or || is a command. In either case, the left command is executed and its exit status examined. If the operator is && the right command is executed if the left command's status is null. || causes the right command to be executed if the left command's status is non-null.
The exit status of a command may be inverted (non-null is changed to null, null is changed to non-null) by preceding it with a !.
The | operator has highest precedence, and is left-associative (i.e. binds tighter to the left than the right). ! has intermediate precedence, and && and || have the lowest precedence.
The unary @ operator, with precedence equal to !, causes its operand to be executed in a subshell.
Each of the following is a command.
When rc starts executing it reads variable and function definitions from its environment.
Using ~ to check the value of $status changes $status.
Functions containing here documents don't work.
Free carets don't get inserted next to keywords.
9srv Manual Collection/plan9/rc(1) | Rev: Wed Jul 23 01:51:36 BST 2008 |