1 | .\" Copyright (c) 1980, 1990, 1993 |
---|
2 | .\" The Regents of the University of California. All rights reserved. |
---|
3 | .\" |
---|
4 | .\" Redistribution and use in source and binary forms, with or without |
---|
5 | .\" modification, are permitted provided that the following conditions |
---|
6 | .\" are met: |
---|
7 | .\" 1. Redistributions of source code must retain the above copyright |
---|
8 | .\" notice, this list of conditions and the following disclaimer. |
---|
9 | .\" 2. Redistributions in binary form must reproduce the above copyright |
---|
10 | .\" notice, this list of conditions and the following disclaimer in the |
---|
11 | .\" documentation and/or other materials provided with the distribution. |
---|
12 | .\" 3. All advertising materials mentioning features or use of this software |
---|
13 | .\" must display the following acknowledgement: |
---|
14 | .\" This product includes software developed by the University of |
---|
15 | .\" California, Berkeley and its contributors. |
---|
16 | .\" 4. Neither the name of the University nor the names of its contributors |
---|
17 | .\" may be used to endorse or promote products derived from this software |
---|
18 | .\" without specific prior written permission. |
---|
19 | .\" |
---|
20 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
---|
21 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
22 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
23 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
---|
24 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
---|
25 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
---|
26 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
---|
27 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
---|
28 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
---|
29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
---|
30 | .\" SUCH DAMAGE. |
---|
31 | .\" |
---|
32 | .\" Style notes for the tcsh manpage: |
---|
33 | .\" |
---|
34 | .\" - Tags in lists are bold, except in the FILES section where they are |
---|
35 | .\" italic. |
---|
36 | .\" |
---|
37 | .\" - References are bold for section headings and environment and shell |
---|
38 | .\" variables and italic for commands (externals, builtins, aliases, and |
---|
39 | .\" editor commands) and arguments to commands. |
---|
40 | .\" |
---|
41 | .\" - Be careful with the .B and .I macros: they only handle a limited number |
---|
42 | .\" of words. Work around this with \fB and \fI, but only if absolutely |
---|
43 | .\" necessary, since tcsh.man2html uses .B/.I to find name anchors. |
---|
44 | .\" |
---|
45 | .\" - Indent in multiples of 4, usually 8. |
---|
46 | .\" |
---|
47 | .\" - Use `', not '' or "", except of course in shell syntax examples. |
---|
48 | .\" '' at the beginning of a line will vanish! |
---|
49 | .\" |
---|
50 | .\" - Use \-, not -. |
---|
51 | .\" |
---|
52 | .\" - Include the tilde when naming dotfiles. `~/.login', not `.login'. |
---|
53 | .\" |
---|
54 | .\" - Refer to external commands in manpage format, e.g. `csh(1)'. However, |
---|
55 | .\" tcsh is `tcsh', not `tcsh(1)', because this is the tcsh manpage (and |
---|
56 | .\" see the next note anyway). |
---|
57 | .\" |
---|
58 | .\" - Say `the shell', not `tcsh', unless distinguishing between tcsh and csh. |
---|
59 | .\" |
---|
60 | .\" - Say `shell variable'/`environment variable' instead of `variable' |
---|
61 | .\" and `builtin command'/`editor command' instead of `builtin' or `command' |
---|
62 | .\" unless the distinction is absolutely clear from context. |
---|
63 | .\" |
---|
64 | .\" - Use the simple present tense. `The shell uses', not `The shell will use'. |
---|
65 | .\" |
---|
66 | .\" - IMPORTANT: Cross-reference as much as possible. Commands, variables, |
---|
67 | .\" etc. in the reference section should be mentioned in the appropriate |
---|
68 | .\" descriptive section, or at least in the reference-section description |
---|
69 | .\" of another command (or whatever) which is mentioned in a description |
---|
70 | .\" section. Remember to note OS-specific things in "OS variant support", |
---|
71 | .\" new features in NEW FEATURES and referenced external commands in SEE |
---|
72 | .\" ALSO. |
---|
73 | .\" |
---|
74 | .\" - tcsh.man2html depends heavily on the specific nroff commands used in the |
---|
75 | .\" manpage when the script was written. Please stick closely to the style |
---|
76 | .\" used here if you can. In particular, please don't use nroff commands |
---|
77 | .\" which aren't already used herein. |
---|
78 | .\" |
---|
79 | .TH TCSH 1 "2 October 1998" "Astron 6.08.00" |
---|
80 | .SH NAME |
---|
81 | tcsh \- C shell with file name completion and command line editing |
---|
82 | .SH SYNOPSIS |
---|
83 | .B tcsh \fR[\fB\-bcdefFimnqstvVxX\fR] [\fB\-Dname\fR[\fB=value\fR]] [arg ...] |
---|
84 | .br |
---|
85 | .B tcsh \-l |
---|
86 | .SH DESCRIPTION |
---|
87 | \fItcsh\fR is an enhanced but completely compatible version of the Berkeley |
---|
88 | UNIX C shell, \fIcsh\fR(1). |
---|
89 | It is a command language interpreter usable both as an interactive login |
---|
90 | shell and a shell script command processor. |
---|
91 | It includes a command-line editor (see \fBThe command-line editor\fR), |
---|
92 | programmable word completion (see \fBCompletion and listing\fR), |
---|
93 | spelling correction (see \fBSpelling correction\fR), |
---|
94 | a history mechanism (see \fBHistory substitution\fR), |
---|
95 | job control (see \fBJobs\fR) |
---|
96 | and a C-like syntax. |
---|
97 | The \fBNEW FEATURES\fR section describes major enhancements of \fItcsh\fR |
---|
98 | over \fIcsh\fR(1). |
---|
99 | Throughout this manual, features of |
---|
100 | \fItcsh\fR not found in most \fIcsh\fR(1) implementations |
---|
101 | (specifically, the 4.4BSD \fIcsh\fR) |
---|
102 | are labeled with `(+)', and features which are present in \fIcsh\fR(1) |
---|
103 | but not usually documented are labeled with `(u)'. |
---|
104 | .SS "Argument list processing" |
---|
105 | If the first argument (argument 0) to the shell is `\-' then it is a |
---|
106 | login shell. A login shell can be also specified by invoking the shell with |
---|
107 | the \fB\-l\fR flag as the only argument. |
---|
108 | .PP |
---|
109 | The rest of the flag arguments are interpreted as follows: |
---|
110 | .TP 4 |
---|
111 | .B \-b |
---|
112 | Forces a ``break'' from option processing, causing any |
---|
113 | further shell arguments to be treated as non-option arguments. The remaining |
---|
114 | arguments will not be interpreted as shell options. This may be used to pass |
---|
115 | options to a shell script without confusion or possible subterfuge. The shell |
---|
116 | will not run a set-user ID script without this option. |
---|
117 | .TP 4 |
---|
118 | .B \-c |
---|
119 | Commands are read from the following argument (which must be present, and |
---|
120 | must be a single argument), |
---|
121 | stored in the \fBcommand\fR shell variable for reference, and executed. |
---|
122 | Any remaining arguments are placed in the \fBargv\fR shell variable. |
---|
123 | .TP 4 |
---|
124 | .B \-d |
---|
125 | The shell loads the directory stack from \fI~/.cshdirs\fR as described under |
---|
126 | \fBStartup and shutdown\fR, whether or not it is a login shell. (+) |
---|
127 | .TP 4 |
---|
128 | .B \-D\fIname\fR[=\fIvalue\fR] |
---|
129 | Sets the environment variable \fIname\fR to \fIvalue\fR. (Domain/OS only) (+) |
---|
130 | .TP 4 |
---|
131 | .B \-e |
---|
132 | The shell exits if any invoked command terminates abnormally or |
---|
133 | yields a non-zero exit status. |
---|
134 | .TP 4 |
---|
135 | .B \-f |
---|
136 | The shell ignores \fI~/.tcshrc\fR, and thus starts faster. |
---|
137 | .TP 4 |
---|
138 | .B \-F |
---|
139 | The shell uses \fIfork\fR(2) instead of \fIvfork\fR(2) to spawn processes. (Convex/OS only) (+) |
---|
140 | .TP 4 |
---|
141 | .B \-i |
---|
142 | The shell is interactive and prompts for its top-level input, even if |
---|
143 | it appears to not be a terminal. Shells are interactive without this option if |
---|
144 | their inputs and outputs are terminals. |
---|
145 | .TP 4 |
---|
146 | .B \-l |
---|
147 | The shell is a login shell. Only applicable if \fB\-l\fR is the only |
---|
148 | flag specified. |
---|
149 | .TP 4 |
---|
150 | .B \-m |
---|
151 | The shell loads \fI~/.tcshrc\fR even if it does not belong to the effective |
---|
152 | user. Newer versions of \fIsu\fR(1) can pass \fB\-m\fR to the shell. (+) |
---|
153 | .TP 4 |
---|
154 | .B \-n |
---|
155 | The shell parses commands but does not execute them. |
---|
156 | This aids in debugging shell scripts. |
---|
157 | .TP 4 |
---|
158 | .B \-q |
---|
159 | The shell accepts SIGQUIT (see \fBSignal handling\fR) and behaves when |
---|
160 | it is used under a debugger. Job control is disabled. (u) |
---|
161 | .TP 4 |
---|
162 | .B \-s |
---|
163 | Command input is taken from the standard input. |
---|
164 | .TP 4 |
---|
165 | .B \-t |
---|
166 | The shell reads and executes a single line of input. A `\\' may be used to |
---|
167 | escape the newline at the end of this line and continue onto another line. |
---|
168 | .TP 4 |
---|
169 | .B \-v |
---|
170 | Sets the \fBverbose\fR shell variable, so that |
---|
171 | command input is echoed after history substitution. |
---|
172 | .TP 4 |
---|
173 | .B \-x |
---|
174 | Sets the \fBecho\fR shell variable, so that commands are echoed |
---|
175 | immediately before execution. |
---|
176 | .TP 4 |
---|
177 | .B \-V |
---|
178 | Sets the \fBverbose\fR shell variable even before executing \fI~/.tcshrc\fR. |
---|
179 | .TP 4 |
---|
180 | .B \-X |
---|
181 | Is to \fB\-x\fR as \fB\-V\fR is to \fB\-v\fR. |
---|
182 | .PP |
---|
183 | After processing of flag arguments, if arguments remain but none of the |
---|
184 | \fB\-c\fR, \fB\-i\fR, \fB\-s\fR, or \fB\-t\fR options were given, the first |
---|
185 | argument is taken as the name of a file of commands, or ``script'', to |
---|
186 | be executed. The shell opens this file and saves its name for possible |
---|
187 | resubstitution by `$0'. Since many systems use either the standard |
---|
188 | version 6 or version 7 shells whose shell scripts are not compatible |
---|
189 | with this shell, the shell uses such a `standard' shell to execute a script |
---|
190 | whose first character is not a `#', i.e. which does not start with a |
---|
191 | comment. |
---|
192 | .PP |
---|
193 | Remaining arguments are placed in the \fBargv\fR shell variable. |
---|
194 | .SS "Startup and shutdown" |
---|
195 | A login shell begins by executing commands from the system files |
---|
196 | \fI/etc/csh.cshrc\fR and \fI/etc/csh.login\fR. |
---|
197 | It then executes commands from files in the user's \fBhome\fR directory: |
---|
198 | first \fI~/.tcshrc\fR (+) |
---|
199 | or, if \fI~/.tcshrc\fR is not found, \fI~/.cshrc\fR, |
---|
200 | then \fI~/.history\fR (or the value of the \fBhistfile\fR shell variable), |
---|
201 | then \fI~/.login\fR, |
---|
202 | and finally \fI~/.cshdirs\fR (or the value of the \fBdirsfile\fR shell variable) (+). |
---|
203 | The shell may read \fI/etc/csh.login\fR before instead of after |
---|
204 | \fI/etc/csh.cshrc\fR, and \fI~/.login\fR before instead of after |
---|
205 | \fI~/.tcshrc\fR or \fI~/.cshrc\fR and \fI~/.history\fR, if so compiled; |
---|
206 | see the \fBversion\fR shell variable. (+) |
---|
207 | .PP |
---|
208 | Non-login shells read only \fI/etc/csh.cshrc\fR and \fI~/.tcshrc\fR |
---|
209 | or \fI~/.cshrc\fR on startup. |
---|
210 | .PP |
---|
211 | Commands like \fIstty\fR(1) and \fItset\fR(1), |
---|
212 | which need be run only once per login, usually go in one's \fI~/.login\fR file. |
---|
213 | Users who need to use the same set of files with both \fIcsh\fR(1) and |
---|
214 | \fItcsh\fR can have only a \fI~/.cshrc\fR which checks for the existence of the |
---|
215 | \fBtcsh\fR shell variable (q.v.) before using \fItcsh\fR-specific commands, |
---|
216 | or can have both a \fI~/.cshrc\fR and a \fI~/.tcshrc\fR which \fIsource\fRs |
---|
217 | (see the builtin command) \fI~/.cshrc\fR. |
---|
218 | The rest of this manual uses `\fI~/.tcshrc\fR' to mean `\fI~/.tcshrc\fR or, |
---|
219 | if \fI~/.tcshrc\fR is not found, \fI~/.cshrc\fR'. |
---|
220 | .PP |
---|
221 | In the normal case, the shell begins reading commands from the terminal, |
---|
222 | prompting with `> '. (Processing of arguments and the use of the shell to |
---|
223 | process files containing command scripts are described later.) |
---|
224 | The shell repeatedly reads a line of command input, breaks it into words, |
---|
225 | places it on the command history list, parses it and executes each command |
---|
226 | in the line. |
---|
227 | .PP |
---|
228 | One can log out by typing `^D' on an empty line, `logout' or `login' or |
---|
229 | via the shell's autologout mechanism (see the \fBautologout\fR shell variable). |
---|
230 | When a login shell terminates it sets the \fBlogout\fR shell variable to |
---|
231 | `normal' or `automatic' as appropriate, then |
---|
232 | executes commands from the files |
---|
233 | \fI/etc/csh.logout\fR and \fI~/.logout\fR. The shell may drop DTR on logout |
---|
234 | if so compiled; see the \fBversion\fR shell variable. |
---|
235 | .PP |
---|
236 | The names of the system login and logout files vary from system to system for |
---|
237 | compatibility with different \fIcsh\fR(1) variants; see \fBFILES\fR. |
---|
238 | .SS Editing |
---|
239 | We first describe \fBThe command-line editor\fR. |
---|
240 | The \fBCompletion and listing\fR and \fBSpelling correction\fR sections |
---|
241 | describe two sets of functionality which are implemented as editor commands |
---|
242 | but which deserve their own treatment. |
---|
243 | Finally, \fBEditor commands\fR lists and describes |
---|
244 | the editor commands specific to the shell and their default bindings. |
---|
245 | .SS "The command-line editor (+)" |
---|
246 | Command-line input can be edited using key sequences much like those used in |
---|
247 | GNU Emacs or \fIvi\fR(1). |
---|
248 | The editor is active only when the \fBedit\fR shell variable is set, which |
---|
249 | it is by default in interactive shells. |
---|
250 | The \fIbindkey\fR builtin can display and change key bindings. |
---|
251 | Emacs-style key bindings are used by default |
---|
252 | (unless the shell was compiled otherwise; see the \fBversion\fR shell variable), |
---|
253 | but \fIbindkey\fR can change the key bindings to \fIvi\fR-style bindings en masse. |
---|
254 | .PP |
---|
255 | The shell always binds the arrow keys (as defined in the \fBTERMCAP\fR |
---|
256 | environment variable) to |
---|
257 | .PP |
---|
258 | .PD 0 |
---|
259 | .RS +4 |
---|
260 | .TP 8 |
---|
261 | down |
---|
262 | \fIdown-history\fR |
---|
263 | .TP 8 |
---|
264 | up |
---|
265 | \fIup-history\fR |
---|
266 | .TP 8 |
---|
267 | left |
---|
268 | \fIbackward-char\fR |
---|
269 | .TP 8 |
---|
270 | right |
---|
271 | \fIforward-char\fR |
---|
272 | .PD |
---|
273 | .RE |
---|
274 | .PP |
---|
275 | unless doing so would alter another single-character binding. |
---|
276 | One can set the arrow key escape sequences to the empty string with \fIsettc\fR |
---|
277 | to prevent these bindings. |
---|
278 | The ANSI/VT100 sequences for arrow keys are always bound. |
---|
279 | .PP |
---|
280 | Other key bindings are, for the most part, what Emacs and \fIvi\fR(1) |
---|
281 | users would expect and can easily be displayed by \fIbindkey\fR, so there |
---|
282 | is no need to list them here. Likewise, \fIbindkey\fR can list the editor |
---|
283 | commands with a short description of each. |
---|
284 | .PP |
---|
285 | Note that editor commands do not have the same notion of a ``word'' as does the |
---|
286 | shell. The editor delimits words with any non-alphanumeric characters not in |
---|
287 | the shell variable \fBwordchars\fR, while the shell recognizes only whitespace |
---|
288 | and some of the characters with special meanings to it, listed under |
---|
289 | \fBLexical structure\fR. |
---|
290 | .SS "Completion and listing (+)" |
---|
291 | The shell is often able to complete words when given a unique abbreviation. |
---|
292 | Type part of a word (for example `ls /usr/lost') and hit the tab key to |
---|
293 | run the \fIcomplete-word\fR editor command. |
---|
294 | The shell completes the filename `/usr/lost' to `/usr/lost+found/', |
---|
295 | replacing the incomplete word with the complete word in the input buffer. |
---|
296 | (Note the terminal `/'; completion adds a `/' to the |
---|
297 | end of completed directories and a space to the end of other completed words, |
---|
298 | to speed typing and provide a visual indicator of successful completion. |
---|
299 | The \fBaddsuffix\fR shell variable can be unset to prevent this.) |
---|
300 | If no match is found (perhaps `/usr/lost+found' doesn't exist), |
---|
301 | the terminal bell rings. |
---|
302 | If the word is already complete (perhaps there is a `/usr/lost' on your |
---|
303 | system, or perhaps you were thinking too far ahead and typed the whole thing) |
---|
304 | a `/' or space is added to the end if it isn't already there. |
---|
305 | .PP |
---|
306 | Completion works anywhere in the line, not just at the end; completed |
---|
307 | text pushes the rest of the line to the right. Completion in the middle of a word |
---|
308 | often results in leftover characters to the right of the cursor which need |
---|
309 | to be deleted. |
---|
310 | .PP |
---|
311 | Commands and variables can be completed in much the same way. |
---|
312 | For example, typing `em[tab]' would complete `em' to |
---|
313 | `emacs' if \fIemacs\fR were the only command on your system beginning with `em'. |
---|
314 | Completion can find a command in any directory in \fBpath\fR or if |
---|
315 | given a full pathname. |
---|
316 | Typing `echo $ar[tab]' would complete `$ar' to `$argv' |
---|
317 | if no other variable began with `ar'. |
---|
318 | .PP |
---|
319 | The shell parses the input buffer to determine whether the word you want to |
---|
320 | complete should be completed as a filename, command or variable. |
---|
321 | The first word in the buffer and the first word following |
---|
322 | `;', `|', `|&', `&&' or `||' is considered to be a command. |
---|
323 | A word beginning with `$' is considered to be a variable. |
---|
324 | Anything else is a filename. An empty line is `completed' as a filename. |
---|
325 | .PP |
---|
326 | You can list the possible completions of a word at any time by typing `^D' |
---|
327 | to run the \fIdelete-char-or-list-or-eof\fR editor command. |
---|
328 | The shell lists the possible completions using the \fIls\-F\fR builtin (q.v.) |
---|
329 | and reprints the prompt and unfinished command line, for example: |
---|
330 | .IP "" 4 |
---|
331 | > ls /usr/l[^D] |
---|
332 | .br |
---|
333 | lbin/ lib/ local/ lost+found/ |
---|
334 | .br |
---|
335 | > ls /usr/l |
---|
336 | .PP |
---|
337 | If the \fBautolist\fR shell variable is set, the shell lists the remaining |
---|
338 | choices (if any) whenever completion fails: |
---|
339 | .IP "" 4 |
---|
340 | > set autolist |
---|
341 | .br |
---|
342 | > nm /usr/lib/libt[tab] |
---|
343 | .br |
---|
344 | libtermcap.a@ libtermlib.a@ |
---|
345 | .br |
---|
346 | > nm /usr/lib/libterm |
---|
347 | .PP |
---|
348 | If \fBautolist\fR is set to `ambiguous', choices are listed only when |
---|
349 | completion fails and adds no new characters to the word being completed. |
---|
350 | .PP |
---|
351 | A filename to be completed can contain variables, your own or others' home |
---|
352 | directories abbreviated with `~' (see \fBFilename substitution\fR) and |
---|
353 | directory stack entries abbreviated with `=' |
---|
354 | (see \fBDirectory stack substitution\fR). For example, |
---|
355 | .IP "" 4 |
---|
356 | > ls ~k[^D] |
---|
357 | .br |
---|
358 | kahn kas kellogg |
---|
359 | .br |
---|
360 | > ls ~ke[tab] |
---|
361 | .br |
---|
362 | > ls ~kellogg/ |
---|
363 | .PP |
---|
364 | or |
---|
365 | .IP "" 4 |
---|
366 | > set local = /usr/local |
---|
367 | .br |
---|
368 | > ls $lo[tab] |
---|
369 | .br |
---|
370 | > ls $local/[^D] |
---|
371 | .br |
---|
372 | bin/ etc/ lib/ man/ src/ |
---|
373 | .br |
---|
374 | > ls $local/ |
---|
375 | .PP |
---|
376 | Note that variables can also be expanded explicitly with the |
---|
377 | \fIexpand-variables\fR editor command. |
---|
378 | .PP |
---|
379 | \fIdelete-char-or-list-or-eof\fR only lists at the end of the line; |
---|
380 | in the middle of a line it deletes the character under the cursor and |
---|
381 | on an empty line it logs one out or, if \fBignoreeof\fR is set, does nothing. |
---|
382 | `M-^D', bound to the editor command \fIlist-choices\fR, lists completion |
---|
383 | possibilities anywhere on a line, and \fIlist-choices\fR (or any one of the |
---|
384 | related editor commands which do or don't delete, list and/or log out, |
---|
385 | listed under \fIdelete-char-or-list-or-eof\fR) can be bound to `^D' with |
---|
386 | the \fIbindkey\fR builtin command if so desired. |
---|
387 | .PP |
---|
388 | The \fIcomplete-word-fwd\fR and \fIcomplete-word-back\fR editor commands |
---|
389 | (not bound to any keys by default) can be used to cycle up and down through |
---|
390 | the list of possible completions, replacing the current word with the next or |
---|
391 | previous word in the list. |
---|
392 | .PP |
---|
393 | The shell variable \fBfignore\fR can be set to a list of suffixes to be |
---|
394 | ignored by completion. Consider the following: |
---|
395 | .IP "" 4 |
---|
396 | > ls |
---|
397 | .br |
---|
398 | Makefile condiments.h~ main.o side.c |
---|
399 | .br |
---|
400 | README main.c meal side.o |
---|
401 | .br |
---|
402 | condiments.h main.c~ |
---|
403 | .br |
---|
404 | > set fignore = (.o \\~) |
---|
405 | .br |
---|
406 | > emacs ma[^D] |
---|
407 | .br |
---|
408 | main.c main.c~ main.o |
---|
409 | .br |
---|
410 | > emacs ma[tab] |
---|
411 | .br |
---|
412 | > emacs main.c |
---|
413 | .PP |
---|
414 | `main.c~' and `main.o' are ignored by completion (but not listing), |
---|
415 | because they end in suffixes in \fBfignore\fR. |
---|
416 | Note that a `\\' was needed in front of `~' to prevent it from being |
---|
417 | expanded to \fBhome\fR as described under \fBFilename substitution\fR. |
---|
418 | \fBfignore\fR is ignored if only one completion is possible. |
---|
419 | .PP |
---|
420 | If the \fBcomplete\fR shell variable is set to `enhance', completion |
---|
421 | 1) ignores case and 2) considers periods, hyphens and underscores |
---|
422 | (`.', `\-' and `_') to be word separators and hyphens and underscores to |
---|
423 | be equivalent. If you had the following files |
---|
424 | .IP "" 4 |
---|
425 | comp.lang.c comp.lang.perl comp.std.c++ |
---|
426 | .br |
---|
427 | comp.lang.c++ comp.std.c |
---|
428 | .PP |
---|
429 | and typed `mail \-f c.l.c[tab]', it would be completed to |
---|
430 | `mail \-f comp.lang.c', and ^D would list `comp.lang.c' and `comp.lang.c++'. |
---|
431 | `mail \-f c..c++[^D]' would list `comp.lang.c++' and `comp.std.c++'. Typing |
---|
432 | `rm a\-\-file[^D]' in the following directory |
---|
433 | .IP "" 4 |
---|
434 | A_silly_file a-hyphenated-file another_silly_file |
---|
435 | .PP |
---|
436 | would list all three files, because case is ignored and hyphens and |
---|
437 | underscores are equivalent. Periods, however, are not equivalent to |
---|
438 | hyphens or underscores. |
---|
439 | .PP |
---|
440 | Completion and listing are affected by several other shell variables: |
---|
441 | \fBrecexact\fR can be set to complete on the shortest possible unique |
---|
442 | match, even if more typing might result in a longer match: |
---|
443 | .IP "" 4 |
---|
444 | > ls |
---|
445 | .br |
---|
446 | fodder foo food foonly |
---|
447 | .br |
---|
448 | > set recexact |
---|
449 | .br |
---|
450 | > rm fo[tab] |
---|
451 | .PP |
---|
452 | just beeps, because `fo' could expand to `fod' or `foo', but if we type |
---|
453 | another `o', |
---|
454 | .IP "" 4 |
---|
455 | > rm foo[tab] |
---|
456 | .br |
---|
457 | > rm foo |
---|
458 | .PP |
---|
459 | the completion completes on `foo', even though `food' and `foonly' |
---|
460 | also match. |
---|
461 | \fBautoexpand\fR can be set to run the \fIexpand-history\fR editor command |
---|
462 | before each completion attempt, \fBautocorrect\fR can be set to |
---|
463 | spelling-correct the word to be completed (see \fBSpelling correction\fR) |
---|
464 | before each completion attempt and \fBcorrect\fR can be set to complete |
---|
465 | commands automatically after one hits `return'. |
---|
466 | \fBmatchbeep\fR can be set to make completion beep or not beep in a variety |
---|
467 | of situations, and \fBnobeep\fR can be set to never beep at all. |
---|
468 | \fBnostat\fR can be set to a list of directories and/or patterns which |
---|
469 | match directories to prevent the completion mechanism from \fIstat\fR(2)ing |
---|
470 | those directories. |
---|
471 | \fBlistmax\fR and \fBlistmaxrows\fR can be set to limit the number of items |
---|
472 | and rows (respectively) that are listed without asking first. |
---|
473 | \fBrecognize_only_executables\fR can be set to make the shell list only |
---|
474 | executables when listing commands, but it is quite slow. |
---|
475 | .PP |
---|
476 | Finally, the \fIcomplete\fR builtin command can be used to tell the shell how |
---|
477 | to complete words other than filenames, commands and variables. |
---|
478 | Completion and listing do not work on glob-patterns (see \fBFilename substitution\fR), |
---|
479 | but the \fIlist-glob\fR and \fIexpand-glob\fR editor commands perform |
---|
480 | equivalent functions for glob-patterns. |
---|
481 | .SS "Spelling correction (+)" |
---|
482 | The shell can sometimes correct the spelling of filenames, commands and variable names |
---|
483 | as well as completing and listing them. |
---|
484 | .PP |
---|
485 | Individual words can be spelling-corrected with the \fIspell-word\fR |
---|
486 | editor command (usually bound to M-s and M-S) |
---|
487 | and the entire input buffer with \fIspell-line\fR (usually bound to M-$). |
---|
488 | The \fBcorrect\fR shell variable can be set to `cmd' to correct the |
---|
489 | command name or `all' to correct the entire line each time return is typed, |
---|
490 | and \fBautocorrect\fR can be set to correct the word to be completed |
---|
491 | before each completion attempt. |
---|
492 | .PP |
---|
493 | When spelling correction is invoked in any of these ways and |
---|
494 | the shell thinks that any part of the command line is misspelled, |
---|
495 | it prompts with the corrected line: |
---|
496 | .IP "" 4 |
---|
497 | > set correct = cmd |
---|
498 | .br |
---|
499 | > lz /usr/bin |
---|
500 | .br |
---|
501 | CORRECT>ls /usr/bin (y|n|e|a)? |
---|
502 | .PP |
---|
503 | One can answer `y' or space to execute the corrected line, |
---|
504 | `e' to leave the uncorrected command in the input buffer, |
---|
505 | `a' to abort the command as if `^C' had been hit, and |
---|
506 | anything else to execute the original line unchanged. |
---|
507 | .PP |
---|
508 | Spelling correction recognizes user-defined completions (see the |
---|
509 | \fIcomplete\fR builtin command). If an input word in a position for |
---|
510 | which a completion is defined resembles a word in the completion list, |
---|
511 | spelling correction registers a misspelling and suggests the latter |
---|
512 | word as a correction. However, if the input word does not match any of |
---|
513 | the possible completions for that position, spelling correction does |
---|
514 | not register a misspelling. |
---|
515 | .PP |
---|
516 | Like completion, spelling correction works anywhere in the line, |
---|
517 | pushing the rest of the line to the right and possibly leaving |
---|
518 | extra characters to the right of the cursor. |
---|
519 | .PP |
---|
520 | Beware: spelling correction is not guaranteed to work the way one intends, |
---|
521 | and is provided mostly as an experimental feature. |
---|
522 | Suggestions and improvements are welcome. |
---|
523 | .SS "Editor commands (+)" |
---|
524 | `bindkey' lists key bindings and `bindkey \-l' lists and briefly describes |
---|
525 | editor commands. |
---|
526 | Only new or especially interesting editor commands are described here. |
---|
527 | See \fIemacs\fR(1) and \fIvi\fR(1) for descriptions of each editor's |
---|
528 | key bindings. |
---|
529 | .PP |
---|
530 | The character or characters to which each command is bound by default is |
---|
531 | given in parentheses. `^\fIcharacter\fR' means a control character and |
---|
532 | `M-\fIcharacter\fR' a meta character, typed as escape-\fIcharacter\fR |
---|
533 | on terminals without a meta key. Case counts, but commands which are bound |
---|
534 | to letters by default are bound to both lower- and uppercase letters for |
---|
535 | convenience. |
---|
536 | .TP 8 |
---|
537 | .B complete-word \fR(tab) |
---|
538 | Completes a word as described under \fBCompletion and listing\fR. |
---|
539 | .TP 8 |
---|
540 | .B complete-word-back \fR(not bound) |
---|
541 | Like \fIcomplete-word-fwd\fR, but steps up from the end of the list. |
---|
542 | .TP 8 |
---|
543 | .B complete-word-fwd \fR(not bound) |
---|
544 | Replaces the current word with the first word in the list of possible |
---|
545 | completions. May be repeated to step down through the list. |
---|
546 | At the end of the list, beeps and reverts to the incomplete word. |
---|
547 | .TP 8 |
---|
548 | .B complete-word-raw \fR(^X-tab) |
---|
549 | Like \fIcomplete-word\fR, but ignores user-defined completions. |
---|
550 | .TP 8 |
---|
551 | .B copy-prev-word \fR(M-^_) |
---|
552 | Copies the previous word in the current line into the input buffer. |
---|
553 | See also \fIinsert-last-word\fR. |
---|
554 | .TP 8 |
---|
555 | .B dabbrev-expand \fR(M-/) |
---|
556 | Expands the current word to the most recent preceding one for which |
---|
557 | the current is a leading substring, wrapping around the history list |
---|
558 | (once) if necessary. |
---|
559 | Repeating \fIdabbrev-expand\fR without any intervening typing |
---|
560 | changes to the next previous word etc., skipping identical matches |
---|
561 | much like \fIhistory-search-backward\fR does. |
---|
562 | .TP 8 |
---|
563 | .B delete-char \fR(not bound) |
---|
564 | Deletes the character under the cursor. |
---|
565 | See also \fIdelete-char-or-list-or-eof\fR. |
---|
566 | .TP 8 |
---|
567 | .B delete-char-or-eof \fR(not bound) |
---|
568 | Does \fIdelete-char\fR if there is a character under the cursor |
---|
569 | or \fIend-of-file\fR on an empty line. |
---|
570 | See also \fIdelete-char-or-list-or-eof\fR. |
---|
571 | .TP 8 |
---|
572 | .B delete-char-or-list \fR(not bound) |
---|
573 | Does \fIdelete-char\fR if there is a character under the cursor |
---|
574 | or \fIlist-choices\fR at the end of the line. |
---|
575 | See also \fIdelete-char-or-list-or-eof\fR. |
---|
576 | .TP 8 |
---|
577 | .B delete-char-or-list-or-eof \fR(^D) |
---|
578 | Does \fIdelete-char\fR if there is a character under the cursor, |
---|
579 | \fIlist-choices\fR at the end of the line |
---|
580 | or \fIend-of-file\fR on an empty line. |
---|
581 | See also those three commands, each of which only does a single action, and |
---|
582 | \fIdelete-char-or-eof\fR, \fIdelete-char-or-list\fR and \fIlist-or-eof\fR, |
---|
583 | each of which does a different two out of the three. |
---|
584 | .TP 8 |
---|
585 | .B down-history \fR(down-arrow, ^N) |
---|
586 | Like \fIup-history\fR, but steps down, stopping at the original input line. |
---|
587 | .TP 8 |
---|
588 | .B end-of-file \fR(not bound) |
---|
589 | Signals an end of file, causing the shell to exit unless the \fBignoreeof\fR |
---|
590 | shell variable (q.v.) is set to prevent this. |
---|
591 | See also \fIdelete-char-or-list-or-eof\fR. |
---|
592 | .TP 8 |
---|
593 | .B expand-history \fR(M-space) |
---|
594 | Expands history substitutions in the current word. |
---|
595 | See \fBHistory substitution\fR. |
---|
596 | See also \fImagic-space\fR, \fItoggle-literal-history\fR and |
---|
597 | the \fBautoexpand\fR shell variable. |
---|
598 | .TP 8 |
---|
599 | .B expand-glob \fR(^X-*) |
---|
600 | Expands the glob-pattern to the left of the cursor. |
---|
601 | See \fBFilename substitution\fR. |
---|
602 | .TP 8 |
---|
603 | .B expand-line \fR(not bound) |
---|
604 | Like \fIexpand-history\fR, but |
---|
605 | expands history substitutions in each word in the input buffer, |
---|
606 | .TP 8 |
---|
607 | .B expand-variables \fR(^X-$) |
---|
608 | Expands the variable to the left of the cursor. |
---|
609 | See \fBVariable substitution\fR. |
---|
610 | .TP 8 |
---|
611 | .B history-search-backward \fR(M-p, M-P) |
---|
612 | Searches backwards through the history list for a command beginning with |
---|
613 | the current contents of the input buffer up to the cursor and copies it |
---|
614 | into the input buffer. |
---|
615 | The search string may be a glob-pattern (see \fBFilename substitution\fR) |
---|
616 | containing `*', `?', `[]' or `{}'. |
---|
617 | \fIup-history\fR and \fIdown-history\fR will proceed from the |
---|
618 | appropriate point in the history list. |
---|
619 | Emacs mode only. |
---|
620 | See also \fIhistory-search-forward\fR and \fIi-search-back\fR. |
---|
621 | .TP 8 |
---|
622 | .B history-search-forward \fR(M-n, M-N) |
---|
623 | Like \fIhistory-search-backward\fR, but searches forward. |
---|
624 | .TP 8 |
---|
625 | .B i-search-back \fR(not bound) |
---|
626 | Searches backward like \fIhistory-search-backward\fR, copies the first match |
---|
627 | into the input buffer with the cursor positioned at the end of the pattern, |
---|
628 | and prompts with `bck: ' and the first match. Additional characters may be |
---|
629 | typed to extend the search, \fIi-search-back\fR may be typed to continue |
---|
630 | searching with the same pattern, wrapping around the history list if |
---|
631 | necessary, (\fIi-search-back\fR must be bound to a |
---|
632 | single character for this to work) or one of the following special characters |
---|
633 | may be typed: |
---|
634 | .PP |
---|
635 | .RS +8 |
---|
636 | .RS +4 |
---|
637 | .PD 0 |
---|
638 | .TP 8 |
---|
639 | ^W |
---|
640 | Appends the rest of the word under the cursor to the search pattern. |
---|
641 | .TP 8 |
---|
642 | delete (or any character bound to \fIbackward-delete-char\fR) |
---|
643 | Undoes the effect of the last character typed and deletes a character |
---|
644 | from the search pattern if appropriate. |
---|
645 | .TP 8 |
---|
646 | ^G |
---|
647 | If the previous search was successful, aborts the entire search. |
---|
648 | If not, goes back to the last successful search. |
---|
649 | .TP 8 |
---|
650 | escape |
---|
651 | Ends the search, leaving the current line in the input buffer. |
---|
652 | .RE |
---|
653 | .PD |
---|
654 | .PP |
---|
655 | Any other character not bound to \fIself-insert-command\fR terminates the |
---|
656 | search, leaving the current line in the input buffer, and |
---|
657 | is then interpreted as normal input. In particular, a carriage return |
---|
658 | causes the current line to be executed. |
---|
659 | Emacs mode only. |
---|
660 | See also \fIi-search-fwd\fR and \fIhistory-search-backward\fR. |
---|
661 | .RE |
---|
662 | .TP 8 |
---|
663 | .B i-search-fwd \fR(not bound) |
---|
664 | Like \fIi-search-back\fR, but searches forward. |
---|
665 | .TP 8 |
---|
666 | .B insert-last-word \fR(M-_) |
---|
667 | Inserts the last word of the previous input line (`!$') into the input buffer. |
---|
668 | See also \fIcopy-prev-word\fR. |
---|
669 | .TP 8 |
---|
670 | .B list-choices \fR(M-^D) |
---|
671 | Lists completion possibilities as described under \fBCompletion and listing\fR. |
---|
672 | See also \fIdelete-char-or-list-or-eof\fR and \fIlist-choices-raw\fR. |
---|
673 | .TP 8 |
---|
674 | .B list-choices-raw \fR(^X-^D) |
---|
675 | Like \fIlist-choices\fR, but ignores user-defined completions. |
---|
676 | .TP 8 |
---|
677 | .B list-glob \fR(^X-g, ^X-G) |
---|
678 | Lists (via the \fIls\-F\fR builtin) matches to the glob-pattern |
---|
679 | (see \fBFilename substitution\fR) to the left of the cursor. |
---|
680 | .TP 8 |
---|
681 | .B list-or-eof \fR(not bound) |
---|
682 | Does \fIlist-choices\fR |
---|
683 | or \fIend-of-file\fR on an empty line. |
---|
684 | See also \fIdelete-char-or-list-or-eof\fR. |
---|
685 | .TP 8 |
---|
686 | .B magic-space \fR(not bound) |
---|
687 | Expands history substitutions in the current line, |
---|
688 | like \fIexpand-history\fR, and appends a space. |
---|
689 | \fImagic-space\fR is designed to be bound to the spacebar, |
---|
690 | but is not bound by default. |
---|
691 | .TP 8 |
---|
692 | .B normalize-command \fR(^X-?) |
---|
693 | Searches for the current word in PATH and, if it is found, replaces it with |
---|
694 | the full path to the executable. Special characters are quoted. Aliases are |
---|
695 | expanded and quoted but commands within aliases are not. This command is |
---|
696 | useful with commands which take commands as arguments, e.g. `dbx' and `sh \-x'. |
---|
697 | .TP 8 |
---|
698 | .B normalize-path \fR(^X-n, ^X-N) |
---|
699 | Expands the current word as described under the `expand' setting |
---|
700 | of the \fBsymlinks\fR shell variable. |
---|
701 | .TP 8 |
---|
702 | .B overwrite-mode \fR(unbound) |
---|
703 | Toggles between input and overwrite modes. |
---|
704 | .TP 8 |
---|
705 | .B run-fg-editor \fR(M-^Z) |
---|
706 | Saves the current input line and |
---|
707 | looks for a stopped job with a name equal to the last component of the |
---|
708 | file name part of the \fBEDITOR\fR or \fBVISUAL\fR environment variables, |
---|
709 | or, if neither is set, `ed' or `vi'. |
---|
710 | If such a job is found, it is restarted as if `fg %\fIjob\fR' had been |
---|
711 | typed. This is used to toggle back and forth between an editor and |
---|
712 | the shell easily. Some people bind this command to `^Z' so they |
---|
713 | can do this even more easily. |
---|
714 | .TP |
---|
715 | .B run-help \fR(M-h, M-H) |
---|
716 | Searches for documentation on the current command, using the same notion of |
---|
717 | `current command' as the completion routines, and prints it. There is no way |
---|
718 | to use a pager; \fIrun-help\fR is designed for short help files. |
---|
719 | Documentation should be in a file named \fIcommand\fR.help, \fIcommand\fR.1, |
---|
720 | \fIcommand\fR.6, \fIcommand\fR.8 or \fIcommand\fR, which should be in one |
---|
721 | of the directories listed in the \fBHPATH\fR enviroment variable. |
---|
722 | If there is more than one help file only the first is printed. |
---|
723 | .TP 8 |
---|
724 | .B self-insert-command \fR(text characters) |
---|
725 | In insert mode (the default), inserts the typed character into the input line after the character under the cursor. |
---|
726 | In overwrite mode, replaces the character under the cursor with the typed character. |
---|
727 | The input mode is normally preserved between lines, but the |
---|
728 | \fBinputmode\fR shell variable can be set to `insert' or `overwrite' to put the |
---|
729 | editor in that mode at the beginning of each line. |
---|
730 | See also \fIoverwrite-mode\fR. |
---|
731 | .TP 8 |
---|
732 | .B sequence-lead-in \fR(arrow prefix, meta prefix, ^X) |
---|
733 | Indicates that the following characters are part of a |
---|
734 | multi-key sequence. Binding a command to a multi-key sequence really creates |
---|
735 | two bindings: the first character to \fIsequence-lead-in\fR and the |
---|
736 | whole sequence to the command. All sequences beginning with a character |
---|
737 | bound to \fIsequence-lead-in\fR are effectively bound to \fIundefined-key\fR |
---|
738 | unless bound to another command. |
---|
739 | .TP 8 |
---|
740 | .B spell-line \fR(M-$) |
---|
741 | Attempts to correct the spelling of each word in the input buffer, like |
---|
742 | \fIspell-word\fR, but ignores words whose first character is one of |
---|
743 | `\-', `!', `^' or `%', or which contain `\\', `*' or `?', to avoid problems |
---|
744 | with switches, substitutions and the like. |
---|
745 | See \fBSpelling correction\fR. |
---|
746 | .TP 8 |
---|
747 | .B spell-word \fR(M-s, M-S) |
---|
748 | Attempts to correct the spelling of the current word as described |
---|
749 | under \fBSpelling correction\fR. |
---|
750 | Checks each component of a word which appears to be a pathname. |
---|
751 | .TP 8 |
---|
752 | .B toggle-literal-history \fR(M-r, M-R) |
---|
753 | Expands or `unexpands' history substitutions in the input buffer. |
---|
754 | See also \fIexpand-history\fR and the \fBautoexpand\fR shell variable. |
---|
755 | .TP 8 |
---|
756 | .B undefined-key \fR(any unbound key) |
---|
757 | Beeps. |
---|
758 | .TP 8 |
---|
759 | .B up-history \fR(up-arrow, ^P) |
---|
760 | Copies the previous entry in the history list into the input buffer. |
---|
761 | If \fBhistlit\fR is set, uses the literal form of the entry. |
---|
762 | May be repeated to step up through the history list, stopping at the top. |
---|
763 | .TP 8 |
---|
764 | .B vi-search-back \fR(?) |
---|
765 | Prompts with `?' for a search string (which may be a glob-pattern, as with |
---|
766 | \fIhistory-search-backward\fR), searches for it and copies it into the |
---|
767 | input buffer. The bell rings if no match is found. |
---|
768 | Hitting return ends the search and leaves the last match in the input |
---|
769 | buffer. |
---|
770 | Hitting escape ends the search and executes the match. |
---|
771 | \fIvi\fR mode only. |
---|
772 | .TP 8 |
---|
773 | .B vi-search-fwd \fR(/) |
---|
774 | Like \fIvi-search-back\fR, but searches forward. |
---|
775 | .TP 8 |
---|
776 | .B which-command \fR(M-?) |
---|
777 | Does a \fIwhich\fR (see the description of the builtin command) on the |
---|
778 | first word of the input buffer. |
---|
779 | .SS "Lexical structure" |
---|
780 | The shell splits input lines into words at blanks and tabs. The special |
---|
781 | characters `&', `|', `;', `<', `>', `(', and `)' and the doubled characters |
---|
782 | `&&', `||', `<<' and `>>' are always separate words, whether or not they are |
---|
783 | surrounded by whitespace. |
---|
784 | .PP |
---|
785 | When the shell's input is not a terminal, the character `#' is taken to begin a |
---|
786 | comment. Each `#' and the rest of the input line on which it appears is |
---|
787 | discarded before further parsing. |
---|
788 | .PP |
---|
789 | A special character (including a blank or tab) may be prevented from having |
---|
790 | its special meaning, and possibly made part of another word, by preceding it |
---|
791 | with a backslash (`\\') or enclosing it in single (`''), double (`"') or |
---|
792 | backward (``') quotes. When not otherwise quoted a newline preceded by a `\\' |
---|
793 | is equivalent to a blank, but inside quotes this sequence results in a |
---|
794 | newline. |
---|
795 | .PP |
---|
796 | Furthermore, all \fBSubstitutions\fR (see below) except \fBHistory substitution\fR |
---|
797 | can be prevented by enclosing the strings (or parts of strings) |
---|
798 | in which they appear with single quotes or by quoting the crucial character(s) |
---|
799 | (e.g. `$' or ``' for \fBVariable substitution\fR or \fBCommand substitution\fR respectively) |
---|
800 | with `\\'. (\fBAlias substitution\fR is no exception: quoting in any way any |
---|
801 | character of a word for which an \fIalias\fR has been defined prevents |
---|
802 | substitution of the alias. The usual way of quoting an alias is to precede it |
---|
803 | with a backslash.) \fBHistory substitution\fR is prevented by |
---|
804 | backslashes but not by single quotes. Strings quoted with double or backward |
---|
805 | quotes undergo \fBVariable substitution\fR and \fBCommand substitution\fR, but other |
---|
806 | substitutions are prevented. |
---|
807 | .PP |
---|
808 | Text inside single or double quotes becomes a single word (or part of one). |
---|
809 | Metacharacters in these strings, including blanks and tabs, do not form |
---|
810 | separate words. Only in one special case (see \fBCommand substitution\fR |
---|
811 | below) can a double-quoted string yield parts of more than one word; |
---|
812 | single-quoted strings never do. Backward quotes are special: they signal |
---|
813 | \fBCommand substitution\fR (q.v.), which may result in more than one word. |
---|
814 | .PP |
---|
815 | Quoting complex strings, particularly strings which themselves contain quoting |
---|
816 | characters, can be confusing. Remember that quotes need not be used as they are |
---|
817 | in human writing! It may be easier to quote not an entire string, but only |
---|
818 | those parts of the string which need quoting, using different types of quoting |
---|
819 | to do so if appropriate. |
---|
820 | .PP |
---|
821 | The \fBbackslash_quote\fR shell variable (q.v.) can be set to make backslashes |
---|
822 | always quote `\\', `'', and `"'. (+) This may make complex quoting tasks |
---|
823 | easier, but it can cause syntax errors in \fIcsh\fR(1) scripts. |
---|
824 | .SS Substitutions |
---|
825 | We now describe the various transformations the shell performs on the input in |
---|
826 | the order in which they occur. We note in passing the data structures involved |
---|
827 | and the commands and variables which affect them. Remember that substitutions |
---|
828 | can be prevented by quoting as described under \fBLexical structure\fR. |
---|
829 | .SS "History substitution" |
---|
830 | Each command, or ``event'', input from the terminal is saved in the history |
---|
831 | list. The previous command is always saved, and the \fBhistory\fR shell |
---|
832 | variable can be set to a number to save that many commands. The \fBhistdup\fR |
---|
833 | shell variable can be set to not save duplicate events or consecutive duplicate |
---|
834 | events. |
---|
835 | .PP |
---|
836 | Saved commands are numbered sequentially from 1 and stamped with the time. |
---|
837 | It is not usually necessary to use event numbers, but the current event number |
---|
838 | can be made part of the prompt by placing an `!' in the \fBprompt\fR shell variable. |
---|
839 | .PP |
---|
840 | The shell actually saves history in expanded and literal (unexpanded) forms. |
---|
841 | If the \fBhistlit\fR shell variable is set, commands that display and store |
---|
842 | history use the literal form. |
---|
843 | .PP |
---|
844 | The \fIhistory\fR builtin command can print, store in a file, restore |
---|
845 | and clear the history list at any time, |
---|
846 | and the \fBsavehist\fR and \fBhistfile\fR shell variables can be can be set to |
---|
847 | store the history list automatically on logout and restore it on login. |
---|
848 | .PP |
---|
849 | History substitutions introduce words from the history list into the input |
---|
850 | stream, making it easy to repeat commands, repeat arguments of a previous |
---|
851 | command in the current command, or fix spelling mistakes in the previous |
---|
852 | command with little typing and a high degree of confidence. |
---|
853 | .PP |
---|
854 | History substitutions begin with the character `!'. They may begin anywhere in |
---|
855 | the input stream, but they do not nest. The `!' may be preceded by a `\\' to |
---|
856 | prevent its special meaning; for convenience, a `!' is passed unchanged when it |
---|
857 | is followed by a blank, tab, newline, `=' or `('. History substitutions also |
---|
858 | occur when an input line begins with `^'. This special abbreviation will be |
---|
859 | described later. The characters used to signal history substitution (`!' and |
---|
860 | `^') can be changed by setting the \fBhistchars\fR shell variable. Any input |
---|
861 | line which contains a history substitution is printed before it is executed. |
---|
862 | .PP |
---|
863 | A history substitution may have an ``event specification'', which indicates |
---|
864 | the event from which words are to be taken, a ``word designator'', |
---|
865 | which selects particular words from the chosen event, and/or a ``modifier'', |
---|
866 | which manipulates the selected words. |
---|
867 | .PP |
---|
868 | An event specification can be |
---|
869 | .PP |
---|
870 | .PD 0 |
---|
871 | .RS +4 |
---|
872 | .TP 8 |
---|
873 | .I n |
---|
874 | A number, referring to a particular event |
---|
875 | .TP 8 |
---|
876 | \-\fIn\fR |
---|
877 | An offset, referring to the event \fIn\fR before the current event |
---|
878 | .TP 8 |
---|
879 | # |
---|
880 | The current event. |
---|
881 | This should be used carefully in \fIcsh\fR(1), where there is no check for |
---|
882 | recursion. \fItcsh\fR allows 10 levels of recursion. (+) |
---|
883 | .TP 8 |
---|
884 | ! |
---|
885 | The previous event (equivalent to `\-1') |
---|
886 | .TP 8 |
---|
887 | .I s |
---|
888 | The most recent event whose first word begins with the string \fIs\fR |
---|
889 | .TP 8 |
---|
890 | ?\fIs\fR? |
---|
891 | The most recent event which contains the string \fIs\fR. |
---|
892 | The second `?' can be omitted if it is immediately followed by a newline. |
---|
893 | .RE |
---|
894 | .PD |
---|
895 | .PP |
---|
896 | For example, consider this bit of someone's history list: |
---|
897 | .IP "" 4 |
---|
898 | \ 9 8:30 nroff \-man wumpus.man |
---|
899 | .br |
---|
900 | 10 8:31 cp wumpus.man wumpus.man.old |
---|
901 | .br |
---|
902 | 11 8:36 vi wumpus.man |
---|
903 | .br |
---|
904 | 12 8:37 diff wumpus.man.old wumpus.man |
---|
905 | .PP |
---|
906 | The commands are shown with their event numbers and time stamps. |
---|
907 | The current event, which we haven't typed in yet, is event 13. |
---|
908 | `!11' and `!\-2' refer to event 11. |
---|
909 | `!!' refers to the previous event, 12. `!!' can be abbreviated `!' if it is |
---|
910 | followed by `:' (`:' is described below). |
---|
911 | `!n' refers to event 9, which begins with `n'. |
---|
912 | `!?old?' also refers to event 12, which contains `old'. |
---|
913 | Without word designators or modifiers history references simply expand to the |
---|
914 | entire event, so we might type `!cp' to redo the copy command or `!!|more' |
---|
915 | if the `diff' output scrolled off the top of the screen. |
---|
916 | .PP |
---|
917 | History references may be insulated from the surrounding text with braces if |
---|
918 | necessary. For example, `!vdoc' would look for a command beginning with |
---|
919 | `vdoc', and, in this example, not find one, but `!{v}doc' would expand |
---|
920 | unambiguously to `vi wumpus.mandoc'. |
---|
921 | Even in braces, history substitutions do not nest. |
---|
922 | .PP |
---|
923 | (+) While \fIcsh\fR(1) expands, for example, `!3d' to event 3 with the |
---|
924 | letter `d' appended to it, \fItcsh\fR expands it to the last event beginning |
---|
925 | with `3d'; only completely numeric arguments are treated as event numbers. |
---|
926 | This makes it possible to recall events beginning with numbers. |
---|
927 | To expand `!3d' as in \fIcsh\fR(1) say `!\\3d'. |
---|
928 | .PP |
---|
929 | To select words from an event we can follow the event specification by a `:' |
---|
930 | and a designator for the desired words. The words of an input line are |
---|
931 | numbered from 0, the first (usually command) word being 0, the second word |
---|
932 | (first argument) being 1, etc. The basic word designators are: |
---|
933 | .PP |
---|
934 | .PD 0 |
---|
935 | .RS +4 |
---|
936 | .TP 8 |
---|
937 | 0 |
---|
938 | The first (command) word |
---|
939 | .TP 8 |
---|
940 | .I n |
---|
941 | The \fIn\fRth argument |
---|
942 | .TP 8 |
---|
943 | ^ |
---|
944 | The first argument, equivalent to `1' |
---|
945 | .TP 8 |
---|
946 | $ |
---|
947 | The last argument |
---|
948 | .TP 8 |
---|
949 | % |
---|
950 | The word matched by an ?\fIs\fR? search |
---|
951 | .TP 8 |
---|
952 | .I x\-y |
---|
953 | A range of words |
---|
954 | .TP 8 |
---|
955 | .I \-y |
---|
956 | Equivalent to \fI`0\-y'\fR |
---|
957 | .TP 8 |
---|
958 | * |
---|
959 | Equivalent to `^\-$', but returns nothing if the event contains only 1 word |
---|
960 | .TP 8 |
---|
961 | .I x* |
---|
962 | Equivalent to \fI`x\-$'\fR |
---|
963 | .TP 8 |
---|
964 | .I x\- |
---|
965 | Equivalent to \fI`x*'\fR, but omitting the last word (`$') |
---|
966 | .PD |
---|
967 | .RE |
---|
968 | .PP |
---|
969 | Selected words are inserted into the command line separated by single blanks. |
---|
970 | For example, the `diff' command in the previous example might have been |
---|
971 | typed as `diff !!:1.old !!:1' (using `:1' to select the first argument |
---|
972 | from the previous event) or `diff !\-2:2 !\-2:1' to select and swap the |
---|
973 | arguments from the `cp' command. If we didn't care about the order of the |
---|
974 | `diff' we might have said `diff !\-2:1\-2' or simply `diff !\-2:*'. |
---|
975 | The `cp' command might have been written `cp wumpus.man !#:1.old', using `#' |
---|
976 | to refer to the current event. |
---|
977 | `!n:\- hurkle.man' would reuse the first two words from the `nroff' command |
---|
978 | to say `nroff \-man hurkle.man'. |
---|
979 | .PP |
---|
980 | The `:' separating the event specification from the word designator can be |
---|
981 | omitted if the argument selector begins with a `^', `$', `*', `%' or `\-'. |
---|
982 | For example, our `diff' command might have been `diff !!^.old !!^' or, |
---|
983 | equivalently, `diff !!$.old !!$'. However, if `!!' is abbreviated `!', |
---|
984 | an argument selector beginning with `\-' will be interpreted as an event |
---|
985 | specification. |
---|
986 | .PP |
---|
987 | A history reference may have a word designator but no event specification. |
---|
988 | It then references the previous command. |
---|
989 | .ig \" Not true, but we thought it was for a long time ... |
---|
990 | , unless a previous history reference |
---|
991 | occurred on the same line in which case this form repeats the previous |
---|
992 | reference. Thus `!?foo?^ !$' gives the first and last arguments from the |
---|
993 | command matching `?foo?'. |
---|
994 | .. |
---|
995 | Continuing our `diff' example, we could have said simply `diff |
---|
996 | !^.old !^' or, to get the arguments in the opposite order, just `diff !*'. |
---|
997 | .PP |
---|
998 | The word or words in a history reference can be edited, or ``modified'', |
---|
999 | by following it with one or more modifiers, each preceded by a `:': |
---|
1000 | .PP |
---|
1001 | .PD 0 |
---|
1002 | .RS +4 |
---|
1003 | .TP 8 |
---|
1004 | h |
---|
1005 | Remove a trailing pathname component, leaving the head. |
---|
1006 | .TP 8 |
---|
1007 | t |
---|
1008 | Remove all leading pathname components, leaving the tail. |
---|
1009 | .TP 8 |
---|
1010 | r |
---|
1011 | Remove a filename extension `.xxx', leaving the root name. |
---|
1012 | .TP 8 |
---|
1013 | e |
---|
1014 | Remove all but the extension. |
---|
1015 | .TP 8 |
---|
1016 | u |
---|
1017 | Uppercase the first lowercase letter. |
---|
1018 | .TP 8 |
---|
1019 | l |
---|
1020 | Lowercase the first uppercase letter. |
---|
1021 | .TP 8 |
---|
1022 | s\fI/l/r/\fR |
---|
1023 | Substitute \fIl\fR for \fIr\fR. |
---|
1024 | \fIl\fR is simply a string like \fIr\fR, not a regular expression as in |
---|
1025 | the eponymous \fIed\fR(1) command. |
---|
1026 | Any character may be used as the delimiter in place of `/'; |
---|
1027 | a `\\' can be used to quote the delimiter inside \fIl\fR and \fIr\fR. |
---|
1028 | The character `&' in the \fIr\fR is replaced by \fIl\fR; `\\' also quotes `&'. |
---|
1029 | If \fIl\fR is empty (``''), the \fIl\fR from a previous substitution or the |
---|
1030 | \fIs\fR from a previous `?\fIs\fR?' event specification is used. |
---|
1031 | The trailing delimiter may be omitted if it is immediately followed by a newline. |
---|
1032 | .TP 8 |
---|
1033 | & |
---|
1034 | Repeat the previous substitution. |
---|
1035 | .TP 8 |
---|
1036 | g |
---|
1037 | Apply the following modifier once to each word. |
---|
1038 | .TP 8 |
---|
1039 | a (+) |
---|
1040 | Apply the following modifier as many times as possible to a single word. |
---|
1041 | `a' and `g' can be used together to apply a modifier globally. |
---|
1042 | In the current implementation, using the `a' and `s' modifiers together can |
---|
1043 | lead to an infinite loop. For example, `:as/f/ff/' will never terminate. |
---|
1044 | This behavior might change in the future. |
---|
1045 | .TP 8 |
---|
1046 | p |
---|
1047 | Print the new command line but do not execute it. |
---|
1048 | .TP 8 |
---|
1049 | q |
---|
1050 | Quote the substituted words, preventing further substitutions. |
---|
1051 | .TP 8 |
---|
1052 | x |
---|
1053 | Like q, but break into words at blanks, tabs and newlines. |
---|
1054 | .PD |
---|
1055 | .RE |
---|
1056 | .PP |
---|
1057 | Modifiers are applied only to the first modifiable word (unless `g' is used). |
---|
1058 | It is an error for no word to be modifiable. |
---|
1059 | .PP |
---|
1060 | For example, the `diff' command might have been written as `diff wumpus.man.old |
---|
1061 | !#^:r', using `:r' to remove `.old' from the first argument on the same line |
---|
1062 | (`!#^'). We could say `echo hello out there', then `echo !*:u' to capitalize |
---|
1063 | `hello', `echo !*:au' to say it out loud, or `echo !*:agu' to really shout. |
---|
1064 | We might follow `mail \-s "I forgot my password" rot' with `!:s/rot/root' to |
---|
1065 | correct the spelling of `root' (but see \fBSpelling correction\fR for a |
---|
1066 | different approach). |
---|
1067 | .PP |
---|
1068 | There is a special abbreviation for substitutions. |
---|
1069 | `^', when it is the first character on an input line, is equivalent to `!:s^'. |
---|
1070 | Thus we might have said `^rot^root' to make the spelling correction in the |
---|
1071 | previous example. |
---|
1072 | This is the only history substitution which does not explicitly begin with `!'. |
---|
1073 | .PP |
---|
1074 | (+) In \fIcsh\fR as such, only one modifier may be applied to each history |
---|
1075 | or variable expansion. In \fItcsh\fR, more than one may be used, for example |
---|
1076 | .IP "" 4 |
---|
1077 | % mv wumpus.man /usr/man/man1/wumpus.1 |
---|
1078 | .br |
---|
1079 | % man !$:t:r |
---|
1080 | .br |
---|
1081 | man wumpus |
---|
1082 | .PP |
---|
1083 | In \fIcsh\fR, the result would be `wumpus.1:r'. A substitution followed by a |
---|
1084 | colon may need to be insulated from it with braces: |
---|
1085 | .IP "" 4 |
---|
1086 | > mv a.out /usr/games/wumpus |
---|
1087 | .br |
---|
1088 | > setenv PATH !$:h:$PATH |
---|
1089 | .br |
---|
1090 | Bad ! modifier: $. |
---|
1091 | .br |
---|
1092 | > setenv PATH !{\-2$:h}:$PATH |
---|
1093 | .br |
---|
1094 | setenv PATH /usr/games:/bin:/usr/bin:. |
---|
1095 | .PP |
---|
1096 | The first attempt would succeed in \fIcsh\fR but fails in \fItcsh\fR, |
---|
1097 | because \fItcsh\fR expects another modifier after the second colon |
---|
1098 | rather than `$'. |
---|
1099 | .PP |
---|
1100 | Finally, history can be accessed through the editor as well as through |
---|
1101 | the substitutions just described. |
---|
1102 | The \fIup-\fR and \fIdown-history\fR, \fIhistory-search-backward\fR and |
---|
1103 | \fI-forward\fR, \fIi-search-back\fR and \fI-fwd\fR, |
---|
1104 | \fIvi-search-back\fR and \fI-fwd\fR, \fIcopy-prev-word\fR |
---|
1105 | and \fIinsert-last-word\fR editor commands search for |
---|
1106 | events in the history list and copy them into the input buffer. |
---|
1107 | The \fItoggle-literal-history\fR editor command switches between the |
---|
1108 | expanded and literal forms of history lines in the input buffer. |
---|
1109 | \fIexpand-history\fR and \fIexpand-line\fR expand history substitutions |
---|
1110 | in the current word and in the entire input buffer respectively. |
---|
1111 | .SS "Alias substitution" |
---|
1112 | The shell maintains a list of aliases which can be set, unset and printed by |
---|
1113 | the \fIalias\fR and \fIunalias\fR commands. After a command line is parsed |
---|
1114 | into simple commands (see \fBCommands\fR) the first word of each command, |
---|
1115 | left-to-right, is checked to see if it has an alias. If so, the first word is |
---|
1116 | replaced by the alias. If the alias contains a history reference, it undergoes |
---|
1117 | \fBHistory substitution\fR (q.v.) as though the original command were the |
---|
1118 | previous input line. If the alias does not contain a history reference, the |
---|
1119 | argument list is left untouched. |
---|
1120 | .PP |
---|
1121 | Thus if the alias for `ls' were `ls \-l' the command `ls /usr' would become `ls |
---|
1122 | \-l /usr', the argument list here being undisturbed. If the alias for `lookup' |
---|
1123 | were `grep !^ /etc/passwd' then `lookup bill' would become `grep bill |
---|
1124 | /etc/passwd'. Aliases can be used to introduce parser metasyntax. For |
---|
1125 | example, `alias print 'pr \e!* | lpr'' defines a ``command'' (`print') which |
---|
1126 | \fIpr\fR(1)s its arguments to the line printer. |
---|
1127 | .PP |
---|
1128 | Alias substitution is repeated until the first word of the command has no |
---|
1129 | alias. If an alias substitution does not change the first word (as in the |
---|
1130 | previous example) it is flagged to prevent a loop. Other loops are detected and |
---|
1131 | cause an error. |
---|
1132 | .PP |
---|
1133 | Some aliases are referred to by the shell; see \fBSpecial aliases\fR. |
---|
1134 | .SS "Variable substitution" |
---|
1135 | The shell maintains a list of variables, each of which has as value a list of |
---|
1136 | zero or more words. |
---|
1137 | The values of shell variables can be displayed and changed with the |
---|
1138 | \fIset\fR and \fIunset\fR commands. |
---|
1139 | The system maintains its own list of ``environment'' variables. |
---|
1140 | These can be displayed and changed with \fIprintenv\fR, \fIsetenv\fR and |
---|
1141 | \fIunsetenv\fR. |
---|
1142 | .PP |
---|
1143 | (+) Variables may be made read-only with `set \-r' (q.v.) |
---|
1144 | Read-only variables may not be modified or unset; |
---|
1145 | attempting to do so will cause an error. |
---|
1146 | Once made read-only, a variable cannot be made writable, |
---|
1147 | so `set \-r' should be used with caution. |
---|
1148 | Environment variables cannot be made read-only. |
---|
1149 | .PP |
---|
1150 | Some variables are set by the shell or referred to by it. |
---|
1151 | For instance, the \fBargv\fR variable is an image of the shell's argument |
---|
1152 | list, and words of this variable's value are referred to in special ways. |
---|
1153 | Some of the variables referred to by the shell are toggles; |
---|
1154 | the shell does not care what their value is, only whether they are set or not. |
---|
1155 | For instance, the \fBverbose\fR variable is a toggle which causes command |
---|
1156 | input to be echoed. The \fB\-v\fR command line option sets this variable. |
---|
1157 | \fBSpecial shell variables\fR lists all variables which are referred to by the shell. |
---|
1158 | .PP |
---|
1159 | Other operations treat variables numerically. The `@' command permits numeric |
---|
1160 | calculations to be performed and the result assigned to a variable. Variable |
---|
1161 | values are, however, always represented as (zero or more) strings. For the |
---|
1162 | purposes of numeric operations, the null string is considered to be zero, and |
---|
1163 | the second and subsequent words of multiword values are ignored. |
---|
1164 | .PP |
---|
1165 | After the input line is aliased and parsed, and before each command is |
---|
1166 | executed, variable substitution is performed keyed by `$' characters. This |
---|
1167 | expansion can be prevented by preceding the `$' with a `\e' except within `"'s |
---|
1168 | where it \fIalways\fR occurs, and within `''s where it \fInever\fR occurs. |
---|
1169 | Strings quoted by ``' are interpreted later (see \fBCommand substitution\fR |
---|
1170 | below) so `$' substitution does not occur there until later, |
---|
1171 | if at all. A `$' is passed unchanged if followed by a blank, tab, or |
---|
1172 | end-of-line. |
---|
1173 | .PP |
---|
1174 | Input/output redirections are recognized before variable expansion, and are |
---|
1175 | variable expanded separately. Otherwise, the command name and entire argument |
---|
1176 | list are expanded together. It is thus possible for the first (command) word |
---|
1177 | (to this point) to generate more than one word, the first of which becomes the |
---|
1178 | command name, and the rest of which become arguments. |
---|
1179 | .PP |
---|
1180 | Unless enclosed in `"' or given the `:q' modifier the results of variable |
---|
1181 | substitution may eventually be command and filename substituted. Within `"', a |
---|
1182 | variable whose value consists of multiple words expands to a (portion of a) |
---|
1183 | single word, with the words of the variable's value separated by blanks. When |
---|
1184 | the `:q' modifier is applied to a substitution the variable will expand to |
---|
1185 | multiple words with each word separated by a blank and quoted to prevent later |
---|
1186 | command or filename substitution. |
---|
1187 | .PP |
---|
1188 | The following metasequences are provided for introducing variable values into |
---|
1189 | the shell input. Except as noted, it is an error to reference a variable which |
---|
1190 | is not set. |
---|
1191 | .PP |
---|
1192 | .PD 0 |
---|
1193 | $\fIname\fR |
---|
1194 | .TP 8 |
---|
1195 | ${\fIname\fR} |
---|
1196 | Substitutes the words of the value of variable \fIname\fR, each separated |
---|
1197 | by a blank. Braces insulate \fIname\fR from following characters which would |
---|
1198 | otherwise be part of it. Shell variables have names consisting of up to 20 |
---|
1199 | letters and digits starting with a letter. The underscore character is |
---|
1200 | considered a letter. If \fIname\fR is not a shell variable, but is set in the |
---|
1201 | environment, then that value is returned (but `:' modifiers and the other forms |
---|
1202 | given below are not available in this case). |
---|
1203 | .PP |
---|
1204 | $\fIname\fR[\fIselector\fR] |
---|
1205 | .TP 8 |
---|
1206 | ${\fIname\fR[\fIselector\fR]} |
---|
1207 | Substitutes only the selected words from the value of \fIname\fR. |
---|
1208 | The \fIselector\fR is subjected to `$' substitution and may consist of |
---|
1209 | a single number or two numbers separated by a `\-'. |
---|
1210 | The first word of a variable's value is numbered `1'. |
---|
1211 | If the first number of a range is omitted it defaults to `1'. |
---|
1212 | If the last member of a range is omitted it defaults to `$#\fIname\fR'. |
---|
1213 | The \fIselector\fR `*' selects all words. |
---|
1214 | It is not an error for a range to be empty if the |
---|
1215 | second argument is omitted or in range. |
---|
1216 | .TP 8 |
---|
1217 | $0 |
---|
1218 | Substitutes the name of the file from which command input |
---|
1219 | is being read. An error occurs if the name is not known. |
---|
1220 | .PP |
---|
1221 | $\fInumber\fR |
---|
1222 | .TP 8 |
---|
1223 | ${\fInumber\fR} |
---|
1224 | Equivalent to `$argv[\fInumber\fR]'. |
---|
1225 | .TP 8 |
---|
1226 | $* |
---|
1227 | Equivalent to `$argv', which is equivalent to `$argv[*]'. |
---|
1228 | .PD |
---|
1229 | .PP |
---|
1230 | The `:' modifiers described under \fBHistory substitution\fR, except for `:p', |
---|
1231 | can be applied to the substitutions above. More than one may be used. (+) |
---|
1232 | Braces may be needed to insulate a variable substitution from a literal colon |
---|
1233 | just as with \fBHistory substitution\fR (q.v.); any modifiers must appear |
---|
1234 | within the braces. |
---|
1235 | .PP |
---|
1236 | The following substitutions can not be modified with `:' modifiers. |
---|
1237 | .PP |
---|
1238 | .PD 0 |
---|
1239 | $?\fIname\fR |
---|
1240 | .TP 8 |
---|
1241 | ${?\fIname\fR} |
---|
1242 | Substitutes the string `1' if \fIname\fR is set, `0' if it is not. |
---|
1243 | .TP 8 |
---|
1244 | $?0 |
---|
1245 | Substitutes `1' if the current input filename is known, `0' if it is not. |
---|
1246 | Always `0' in interactive shells. |
---|
1247 | .PP |
---|
1248 | $#\fIname\fR |
---|
1249 | .TP 8 |
---|
1250 | ${#\fIname\fR} |
---|
1251 | Substitutes the number of words in \fIname\fR. |
---|
1252 | .TP 8 |
---|
1253 | $# |
---|
1254 | Equivalent to `$#argv'. (+) |
---|
1255 | .PP |
---|
1256 | $%\fIname\fR |
---|
1257 | .TP 8 |
---|
1258 | ${%\fIname\fR} |
---|
1259 | Substitutes the number of characters in \fIname\fR. (+) |
---|
1260 | .PP |
---|
1261 | $%\fInumber\fR |
---|
1262 | .TP 8 |
---|
1263 | ${%\fInumber\fR} |
---|
1264 | Substitutes the number of characters in $argv[\fInumber\fR]. (+) |
---|
1265 | .TP 8 |
---|
1266 | $? |
---|
1267 | Equivalent to `$status'. (+) |
---|
1268 | .TP 8 |
---|
1269 | $$ |
---|
1270 | Substitutes the (decimal) process number of the (parent) shell. |
---|
1271 | .TP 8 |
---|
1272 | $! |
---|
1273 | Substitutes the (decimal) process number of the last |
---|
1274 | background process started by this shell. |
---|
1275 | .TP 8 |
---|
1276 | $< |
---|
1277 | Substitutes a line from the standard input, with no further interpretation |
---|
1278 | thereafter. It can be used to read from the keyboard in a shell script. |
---|
1279 | (+) While \fIcsh\fR always quotes $<, as if it were equivalent to `$<:q', |
---|
1280 | \fItcsh\fR does not. Furthermore, when \fItcsh\fR is waiting for a line to be |
---|
1281 | typed the user may type an interrupt to interrupt the sequence into |
---|
1282 | which the line is to be substituted, but \fIcsh\fR does not allow this. |
---|
1283 | .PD |
---|
1284 | .PP |
---|
1285 | The editor command \fIexpand-variables\fR, normally bound to `^X-$', |
---|
1286 | can be used to interactively expand individual variables. |
---|
1287 | .SS "Command, filename and directory stack substitution" |
---|
1288 | The remaining substitutions are applied selectively to the arguments of builtin |
---|
1289 | commands. This means that portions of expressions which are not evaluated are |
---|
1290 | not subjected to these expansions. For commands which are not internal to the |
---|
1291 | shell, the command name is substituted separately from the argument list. This |
---|
1292 | occurs very late, after input-output redirection is performed, and in a child |
---|
1293 | of the main shell. |
---|
1294 | .SS "Command substitution" |
---|
1295 | Command substitution is indicated by a command enclosed in ``'. The output |
---|
1296 | from such a command is broken into separate words at blanks, tabs and newlines, |
---|
1297 | and null words are discarded. The output is variable and command substituted |
---|
1298 | and put in place of the original string. |
---|
1299 | .PP |
---|
1300 | Command substitutions inside double |
---|
1301 | quotes (`"') retain blanks and tabs; only newlines force new words. The single |
---|
1302 | final newline does not force a new word in any case. It is thus possible for a |
---|
1303 | command substitution to yield only part of a word, even if the command outputs |
---|
1304 | a complete line. |
---|
1305 | .SS "Filename substitution" |
---|
1306 | If a word contains any of the characters `*', `?', `[' or `{' or begins with |
---|
1307 | the character `~' it is a candidate for filename substitution, also known as |
---|
1308 | ``globbing''. This word is then regarded as a pattern (``glob-pattern''), and |
---|
1309 | replaced with an alphabetically sorted list of file names which match the |
---|
1310 | pattern. |
---|
1311 | .PP |
---|
1312 | In matching filenames, the character `.' at the beginning of a filename or |
---|
1313 | immediately following a `/', as well as the character `/' must be matched |
---|
1314 | explicitly. The character `*' matches any string of characters, including the |
---|
1315 | null string. The character `?' matches any single character. The sequence |
---|
1316 | `[...]' matches any one of the characters enclosed. Within `[...]', a pair of |
---|
1317 | characters separated by `\-' matches any character lexically between the two. |
---|
1318 | .PP |
---|
1319 | (+) Some glob-patterns can be negated: |
---|
1320 | The sequence `[^...]' matches any single character \fInot\fR specified by the |
---|
1321 | characters and/or ranges of characters in the braces. |
---|
1322 | .PP |
---|
1323 | An entire glob-pattern can also be negated with `^': |
---|
1324 | .IP "" 4 |
---|
1325 | > echo * |
---|
1326 | .br |
---|
1327 | bang crash crunch ouch |
---|
1328 | .br |
---|
1329 | > echo ^cr* |
---|
1330 | .br |
---|
1331 | bang ouch |
---|
1332 | .PP |
---|
1333 | Glob-patterns which do not use `?', `*', or `[]' or which use `{}' or `~' |
---|
1334 | (below) are not negated correctly. |
---|
1335 | .PP |
---|
1336 | The metanotation `a{b,c,d}e' is a shorthand for `abe ace ade'. |
---|
1337 | Left-to-right order is preserved: `/usr/source/s1/{oldls,ls}.c' expands |
---|
1338 | to `/usr/source/s1/oldls.c /usr/source/s1/ls.c'. The results of matches are |
---|
1339 | sorted separately at a low level to preserve this order: |
---|
1340 | `../{memo,*box}' might expand to `../memo ../box ../mbox'. |
---|
1341 | (Note that `memo' was not sorted with the results of matching `*box'.) |
---|
1342 | It is not an error when this construct expands to files which do not exist, |
---|
1343 | but it is possible to get an error from a command to which the expanded list |
---|
1344 | is passed. |
---|
1345 | This construct may be nested. |
---|
1346 | As a special case the words `{', `}' and `{}' are passed undisturbed. |
---|
1347 | .PP |
---|
1348 | The character `~' at the beginning of a filename refers to home directories. |
---|
1349 | Standing alone, i.e. `~', it expands to the invoker's home directory as |
---|
1350 | reflected in the value of the \fBhome\fR shell variable. When followed by a |
---|
1351 | name consisting of letters, digits and `\-' characters the shell searches for a |
---|
1352 | user with that name and substitutes their home directory; thus `~ken' might |
---|
1353 | expand to `/usr/ken' and `~ken/chmach' to `/usr/ken/chmach'. If the character |
---|
1354 | `~' is followed by a character other than a letter or `/' or appears elsewhere |
---|
1355 | than at the beginning of a word, it is left undisturbed. |
---|
1356 | A command like `setenv MANPATH /usr/man:/usr/local/man:~/lib/man' does not, |
---|
1357 | therefore, do home directory substitution as one might hope. |
---|
1358 | .PP |
---|
1359 | It is an error for a glob-pattern containing `*', `?', `[' or `~', with or |
---|
1360 | without `^', not to match any files. However, only one pattern in a list of |
---|
1361 | glob-patterns must match a file (so that, e.g., `rm *.a *.c *.o' would fail |
---|
1362 | only if there were no files in the current directory ending in `.a', `.c', or |
---|
1363 | `.o'), and if the \fBnonomatch\fR shell variable is set a pattern (or list |
---|
1364 | of patterns) which matches nothing is left unchanged rather than causing |
---|
1365 | an error. |
---|
1366 | .PP |
---|
1367 | The \fBnoglob\fR shell variable can be set to prevent filename substitution, |
---|
1368 | and the \fIexpand-glob\fR editor command, normally bound to `^X-*', can be |
---|
1369 | used to interactively expand individual filename substitutions. |
---|
1370 | .SS "Directory stack substitution (+)" |
---|
1371 | The directory stack is a list of directories, numbered from zero, used by the |
---|
1372 | \fIpushd\fR, \fIpopd\fR and \fIdirs\fR builtin commands (q.v.). |
---|
1373 | \fIdirs\fR can print, store in a file, restore and clear the directory stack |
---|
1374 | at any time, and the \fBsavedirs\fR and \fBdirsfile\fR shell variables can be set to |
---|
1375 | store the directory stack automatically on logout and restore it on login. |
---|
1376 | The \fBdirstack\fR shell variable can be examined to see the directory stack and |
---|
1377 | set to put arbitrary directories into the directory stack. |
---|
1378 | .PP |
---|
1379 | The character `=' followed by one or more digits expands to an entry in |
---|
1380 | the directory stack. The special case `=\-' expands to the last directory in |
---|
1381 | the stack. For example, |
---|
1382 | .IP "" 4 |
---|
1383 | > dirs \-v |
---|
1384 | .br |
---|
1385 | 0 /usr/bin |
---|
1386 | .br |
---|
1387 | 1 /usr/spool/uucp |
---|
1388 | .br |
---|
1389 | 2 /usr/accts/sys |
---|
1390 | .br |
---|
1391 | > echo =1 |
---|
1392 | .br |
---|
1393 | /usr/spool/uucp |
---|
1394 | .br |
---|
1395 | > echo =0/calendar |
---|
1396 | .br |
---|
1397 | /usr/bin/calendar |
---|
1398 | .br |
---|
1399 | > echo =\- |
---|
1400 | .br |
---|
1401 | /usr/accts/sys |
---|
1402 | .PP |
---|
1403 | The \fBnoglob\fR and \fBnonomatch\fR shell variables and the \fIexpand-glob\fR |
---|
1404 | editor command apply to directory stack as well as filename substitutions. |
---|
1405 | .SS "Other substitutions (+)" |
---|
1406 | There are several more transformations involving filenames, not strictly |
---|
1407 | related to the above but mentioned here for completeness. |
---|
1408 | \fIAny\fR filename may be expanded to a full path when the |
---|
1409 | \fBsymlinks\fR variable (q.v.) is set to `expand'. |
---|
1410 | Quoting prevents this expansion, and |
---|
1411 | the \fInormalize-path\fR editor command does it on demand. |
---|
1412 | The \fInormalize-command\fR editor command expands commands in PATH into |
---|
1413 | full paths on demand. |
---|
1414 | Finally, \fIcd\fR and \fIpushd\fR interpret `\-' as the old working directory |
---|
1415 | (equivalent to the shell variable \fBowd\fR). |
---|
1416 | This is not a substitution at all, but an abbreviation recognized only by |
---|
1417 | those commands. Nonetheless, it too can be prevented by quoting. |
---|
1418 | .SS Commands |
---|
1419 | The next three sections describe how the shell executes commands and |
---|
1420 | deals with their input and output. |
---|
1421 | .SS Simple commands, pipelines and sequences |
---|
1422 | A simple command is a sequence of words, the first of which specifies the |
---|
1423 | command to be executed. A series of simple commands joined by `|' characters |
---|
1424 | forms a pipeline. The output of each command in a pipeline is connected to the |
---|
1425 | input of the next. |
---|
1426 | .PP |
---|
1427 | Simple commands and pipelines may be joined into sequences with `;', and will |
---|
1428 | be executed sequentially. Commands and pipelines can also be joined into |
---|
1429 | sequences with `||' or `&&', indicating, as in the C language, that the second |
---|
1430 | is to be executed only if the first fails or succeeds respectively. |
---|
1431 | .PP |
---|
1432 | A simple command, pipeline or sequence may be placed in parentheses, `()', |
---|
1433 | to form a simple command, which may in turn be a component of a pipeline or |
---|
1434 | sequence. A command, pipeline or sequence can be executed |
---|
1435 | without waiting for it to terminate by following it with an `&'. |
---|
1436 | .SS "Builtin and non-builtin command execution" |
---|
1437 | Builtin commands are executed within the shell. If any component of a |
---|
1438 | pipeline except the last is a builtin command, the pipeline is executed |
---|
1439 | in a subshell. |
---|
1440 | .PP |
---|
1441 | Parenthesized commands are always executed in a subshell. |
---|
1442 | .IP "" 4 |
---|
1443 | (cd; pwd); pwd |
---|
1444 | .PP |
---|
1445 | thus prints the \fBhome\fR directory, leaving you where you were |
---|
1446 | (printing this after the home directory), while |
---|
1447 | .IP "" 4 |
---|
1448 | cd; pwd |
---|
1449 | .PP |
---|
1450 | leaves you in the \fBhome\fR directory. Parenthesized commands are most often |
---|
1451 | used to prevent \fIcd\fR from affecting the current shell. |
---|
1452 | .PP |
---|
1453 | When a command to be executed is found not to be a builtin command the shell |
---|
1454 | attempts to execute the command via \fIexecve\fR(2). Each word in the variable |
---|
1455 | \fBpath\fR names a directory in which the shell will look for the |
---|
1456 | command. If it is given neither a \fB\-c\fR nor a \fB\-t\fR option, the shell |
---|
1457 | hashes the names in these directories into an internal table so that it will |
---|
1458 | only try an \fIexecve\fR(2) in a directory if there is a possibility that the |
---|
1459 | command resides there. This greatly speeds command location when a large |
---|
1460 | number of directories are present in the search path. If this mechanism has |
---|
1461 | been turned off (via \fIunhash\fR), if the shell was given a \fB\-c\fR or |
---|
1462 | \fB\-t\fR argument or in any case for each directory component of \fBpath\fR |
---|
1463 | which does not begin with a `/', the shell concatenates the current working |
---|
1464 | directory with the given command name to form a path name of a file which it |
---|
1465 | then attempts to execute. |
---|
1466 | .PP |
---|
1467 | If the file has execute permissions but is not an executable to the system |
---|
1468 | (i.e. it is neither an executable binary nor a script which specifies its |
---|
1469 | interpreter), then it is assumed to be a file containing shell commands and |
---|
1470 | a new shell is spawned to read it. The \fIshell\fR special alias may be set |
---|
1471 | to specify an interpreter other than the shell itself. |
---|
1472 | .PP |
---|
1473 | On systems which do not understand the `#!' script interpreter convention |
---|
1474 | the shell may be compiled to emulate it; see the \fBversion\fR shell |
---|
1475 | variable\fR. If so, the shell checks the first line of the file to |
---|
1476 | see if it is of the form `#!\fIinterpreter\fR \fIarg\fR ...'. If it is, |
---|
1477 | the shell starts \fIinterpreter\fR with the given \fIarg\fRs and feeds the |
---|
1478 | file to it on standard input. |
---|
1479 | .SS Input/output |
---|
1480 | The standard input and standard output of a command may be redirected with the |
---|
1481 | following syntax: |
---|
1482 | .PP |
---|
1483 | .PD 0 |
---|
1484 | .TP 8 |
---|
1485 | < \fIname |
---|
1486 | Open file \fIname\fR (which is first variable, command and filename |
---|
1487 | expanded) as the standard input. |
---|
1488 | .TP 8 |
---|
1489 | << \fIword |
---|
1490 | Read the shell input up to a line which is identical to \fIword\fR. \fIword\fR |
---|
1491 | is not subjected to variable, filename or command substitution, and each input |
---|
1492 | line is compared to \fIword\fR before any substitutions are done on this input |
---|
1493 | line. Unless a quoting `\e', `"', `' or ``' appears in \fIword\fR variable and |
---|
1494 | command substitution is performed on the intervening lines, allowing `\e' to |
---|
1495 | quote `$', `\e' and ``'. Commands which are substituted have all blanks, tabs, |
---|
1496 | and newlines preserved, except for the final newline which is dropped. The |
---|
1497 | resultant text is placed in an anonymous temporary file which is given to the |
---|
1498 | command as standard input. |
---|
1499 | .PP |
---|
1500 | > \fIname |
---|
1501 | .br |
---|
1502 | >! \fIname |
---|
1503 | .br |
---|
1504 | >& \fIname |
---|
1505 | .TP 8 |
---|
1506 | >&! \fIname |
---|
1507 | The file \fIname\fR is used as standard output. If the file does not exist |
---|
1508 | then it is created; if the file exists, its is truncated, its previous contents |
---|
1509 | being lost. |
---|
1510 | .RS +8 |
---|
1511 | .PD |
---|
1512 | .PP |
---|
1513 | If the shell variable \fBnoclobber\fR is set, then the file must not exist or be a |
---|
1514 | character special file (e.g. a terminal or `/dev/null') or an error results. |
---|
1515 | This helps prevent accidental destruction of files. In this case the `!' forms |
---|
1516 | can be used to suppress this check. |
---|
1517 | .PP |
---|
1518 | The forms involving `&' route the diagnostic output into the specified file as |
---|
1519 | well as the standard output. \fIname\fR is expanded in the same way as `<' |
---|
1520 | input filenames are. |
---|
1521 | .PD 0 |
---|
1522 | .RE |
---|
1523 | .PP |
---|
1524 | >> \fIname |
---|
1525 | .br |
---|
1526 | >>& \fIname |
---|
1527 | .br |
---|
1528 | >>! \fIname |
---|
1529 | .TP 8 |
---|
1530 | >>&! \fIname |
---|
1531 | Like `>', but appends output to the end of \fIname\fR. |
---|
1532 | If the shell variable \fBnoclobber\fR is set, then it is an error for |
---|
1533 | the file \fInot\fR to exist, unless one of the `!' forms is given. |
---|
1534 | .PD |
---|
1535 | .PP |
---|
1536 | A command receives the environment in which the shell was invoked as modified |
---|
1537 | by the input-output parameters and the presence of the command in a pipeline. |
---|
1538 | Thus, unlike some previous shells, commands run from a file of shell commands |
---|
1539 | have no access to the text of the commands by default; rather they receive the |
---|
1540 | original standard input of the shell. The `<<' mechanism should be used to |
---|
1541 | present inline data. This permits shell command scripts to function as |
---|
1542 | components of pipelines and allows the shell to block read its input. Note |
---|
1543 | that the default standard input for a command run detached is \fInot\fR |
---|
1544 | the empty file \fI/dev/null\fR, but the original standard input of the shell. |
---|
1545 | If this is a terminal and if the process attempts to read from the terminal, |
---|
1546 | then the process will block and the user will be notified (see \fBJobs\fR). |
---|
1547 | .PP |
---|
1548 | Diagnostic output may be directed through a pipe with the standard output. |
---|
1549 | Simply use the form `|&' rather than just `|'. |
---|
1550 | .PP |
---|
1551 | The shell cannot presently redirect diagnostic output without also redirecting |
---|
1552 | standard output, but `(\fIcommand\fR > \fIoutput-file\fR) >& \fIerror-file\fR' |
---|
1553 | is often an acceptable workaround. Either \fIoutput-file\fR or |
---|
1554 | \fIerror-file\fR may be `/dev/tty' to send output to the terminal. |
---|
1555 | .SS Features |
---|
1556 | Having described how the shell accepts, parses and executes |
---|
1557 | command lines, we now turn to a variety of its useful features. |
---|
1558 | .SS "Control flow" |
---|
1559 | The shell contains a number of commands which can be used to regulate the |
---|
1560 | flow of control in command files (shell scripts) and (in limited but |
---|
1561 | useful ways) from terminal input. These commands all operate by forcing the |
---|
1562 | shell to reread or skip in its input and, due to the implementation, |
---|
1563 | restrict the placement of some of the commands. |
---|
1564 | .PP |
---|
1565 | The \fIforeach\fR, \fIswitch\fR, and \fIwhile\fR statements, as well as the |
---|
1566 | \fIif-then-else\fR form of the \fIif\fR statement, require that the major |
---|
1567 | keywords appear in a single simple command on an input line as shown below. |
---|
1568 | .PP |
---|
1569 | If the shell's input is not seekable, the shell buffers up input whenever |
---|
1570 | a loop is being read and performs seeks in this internal buffer to |
---|
1571 | accomplish the rereading implied by the loop. (To the extent that this |
---|
1572 | allows, backward \fIgoto\fRs will succeed on non-seekable inputs.) |
---|
1573 | .SS Expressions |
---|
1574 | The \fIif\fR, \fIwhile\fR and \fIexit\fR builtin commands |
---|
1575 | use expressions with a common syntax. The expressions can include any |
---|
1576 | of the operators described in the next three sections. Note that the \fI@\fR |
---|
1577 | builtin command (q.v.) has its own separate syntax. |
---|
1578 | .SS "Logical, arithmetical and comparison operators" |
---|
1579 | These operators are similar to those of C and have the same precedence. |
---|
1580 | They include |
---|
1581 | .IP "" 4 |
---|
1582 | || && | ^ & == != =~ !~ <= >= |
---|
1583 | .br |
---|
1584 | < > << >> + \- * / % ! ~ ( ) |
---|
1585 | .PP |
---|
1586 | Here the precedence increases to the right, `==' `!=' `=~' and `!~', `<=' |
---|
1587 | `>=' `<' and `>', `<<' and `>>', `+' and `\-', `*' `/' and `%' being, in |
---|
1588 | groups, at the same level. The `==' `!=' `=~' and `!~' operators compare |
---|
1589 | their arguments as strings; all others operate on numbers. The operators |
---|
1590 | `=~' and `!~' are like `!=' and `==' except that the right hand side is a |
---|
1591 | glob-pattern (see \fBFilename substitution\fR) against which the left hand |
---|
1592 | operand is matched. This reduces the need for use of the \fIswitch\fR |
---|
1593 | builtin command in shell scripts when all that is really needed is |
---|
1594 | pattern matching. |
---|
1595 | .PP |
---|
1596 | Strings which begin with `0' are considered octal numbers. Null or |
---|
1597 | missing arguments are considered `0'. The results of all expressions are |
---|
1598 | strings, which represent decimal numbers. It is important to note that |
---|
1599 | no two components of an expression can appear in the same word; except |
---|
1600 | when adjacent to components of expressions which are syntactically |
---|
1601 | significant to the parser (`&' `|' `<' `>' `(' `)') they should be |
---|
1602 | surrounded by spaces. |
---|
1603 | .SS "Command exit status" |
---|
1604 | Commands can be executed in expressions and their exit status |
---|
1605 | returned by enclosing them in braces (`{}'). Remember that the braces should |
---|
1606 | be separated from the words of the command by spaces. Command executions |
---|
1607 | succeed, returning true, i.e. `1', if the command exits with status 0, |
---|
1608 | otherwise they fail, returning false, i.e. `0'. If more detailed status |
---|
1609 | information is required then the command should be executed outside of an |
---|
1610 | expression and the \fBstatus\fR shell variable examined. |
---|
1611 | .SS "File inquiry operators" |
---|
1612 | Some of these operators perform true/false tests on files and related |
---|
1613 | objects. They are of the form \fB\-\fIop file\fR, where \fIop\fR is one of |
---|
1614 | .PP |
---|
1615 | .PD 0 |
---|
1616 | .RS +4 |
---|
1617 | .TP 4 |
---|
1618 | .B r |
---|
1619 | Read access |
---|
1620 | .TP 4 |
---|
1621 | .B w |
---|
1622 | Write access |
---|
1623 | .TP 4 |
---|
1624 | .B x |
---|
1625 | Execute access |
---|
1626 | .TP 4 |
---|
1627 | .B X |
---|
1628 | Executable in the path or shell builtin, e.g. `\-X ls' and `\-X ls\-F' are |
---|
1629 | generally true, but `\-X /bin/ls' is not (+) |
---|
1630 | .TP 4 |
---|
1631 | .B e |
---|
1632 | Existence |
---|
1633 | .TP 4 |
---|
1634 | .B o |
---|
1635 | Ownership |
---|
1636 | .TP 4 |
---|
1637 | .B z |
---|
1638 | Zero size |
---|
1639 | .TP 4 |
---|
1640 | .B s |
---|
1641 | Non-zero size (+) |
---|
1642 | .TP 4 |
---|
1643 | .B f |
---|
1644 | Plain file |
---|
1645 | .TP 4 |
---|
1646 | .B d |
---|
1647 | Directory |
---|
1648 | .TP 4 |
---|
1649 | .B l |
---|
1650 | Symbolic link (+) * |
---|
1651 | .TP 4 |
---|
1652 | .B b |
---|
1653 | Block special file (+) |
---|
1654 | .TP 4 |
---|
1655 | .B c |
---|
1656 | Character special file (+) |
---|
1657 | .TP 4 |
---|
1658 | .B p |
---|
1659 | Named pipe (fifo) (+) * |
---|
1660 | .TP 4 |
---|
1661 | .B S |
---|
1662 | Socket special file (+) * |
---|
1663 | .TP 4 |
---|
1664 | .B u |
---|
1665 | Set-user-ID bit is set (+) |
---|
1666 | .TP 4 |
---|
1667 | .B g |
---|
1668 | Set-group-ID bit is set (+) |
---|
1669 | .TP 4 |
---|
1670 | .B k |
---|
1671 | Sticky bit is set (+) |
---|
1672 | .TP 4 |
---|
1673 | .B t |
---|
1674 | \fIfile\fR (which must be a digit) is an open file descriptor |
---|
1675 | for a terminal device (+) |
---|
1676 | .TP 4 |
---|
1677 | .B R |
---|
1678 | Has been migrated (convex only) (+) |
---|
1679 | .TP 4 |
---|
1680 | .B L |
---|
1681 | Applies subsequent operators in a multiple-operator test to a symbolic link |
---|
1682 | rather than to the file to which the link points (+) * |
---|
1683 | .RE |
---|
1684 | .PD |
---|
1685 | .PP |
---|
1686 | \fIfile\fR is command and filename expanded and then tested to |
---|
1687 | see if it has the specified relationship to the real user. If \fIfile\fR |
---|
1688 | does not exist or is inaccessible or, for the operators indicated by `*', |
---|
1689 | if the specified file type does not exist on the current system, |
---|
1690 | then all enquiries return false, i.e. `0'. |
---|
1691 | .PP |
---|
1692 | These operators may be combined for conciseness: `\-\fIxy file\fR' is |
---|
1693 | equivalent to `\-\fIx file\fR && \-\fIy file\fR'. (+) For example, `\-fx' is true |
---|
1694 | (returns `1') for plain executable files, but not for directories. |
---|
1695 | .PP |
---|
1696 | \fBL\fR may be used in a multiple-operator test to apply subsequent operators |
---|
1697 | to a symbolic link rather than to the file to which the link points. |
---|
1698 | For example, `\-lLo' is true for links owned by the invoking user. |
---|
1699 | \fBLr\fR, \fBLw\fR and \fBLx\fR are always true for links and false for |
---|
1700 | non-links. \fBL\fR has a different meaning when it is the last operator |
---|
1701 | in a multiple-operator test; see below. |
---|
1702 | .PP |
---|
1703 | It is possible but not useful, and sometimes misleading, to combine operators |
---|
1704 | which expect \fIfile\fR to be a file with operators which do not, |
---|
1705 | (e.g. \fBX\fR and \fBt\fR). Following \fBL\fR with a non-file operator |
---|
1706 | can lead to particularly strange results. |
---|
1707 | .PP |
---|
1708 | Other operators return other information, i.e. not just `0' or `1'. (+) |
---|
1709 | They have the same format as before; \fIop\fR may be one of |
---|
1710 | .PP |
---|
1711 | .PD 0 |
---|
1712 | .RS +4 |
---|
1713 | .TP 8 |
---|
1714 | .B A |
---|
1715 | Last file access time, as the number of seconds since the epoch |
---|
1716 | .TP 8 |
---|
1717 | .B A: |
---|
1718 | Like \fBA\fR, but in timestamp format, e.g. `Fri May 14 16:36:10 1993' |
---|
1719 | .TP 8 |
---|
1720 | .B M |
---|
1721 | Last file modification time |
---|
1722 | .TP 8 |
---|
1723 | .B M: |
---|
1724 | Like \fBM\fR, but in timestamp format |
---|
1725 | .TP 8 |
---|
1726 | .B C |
---|
1727 | Last inode modification time |
---|
1728 | .TP 8 |
---|
1729 | .B C: |
---|
1730 | Like \fBC\fR, but in timestamp format |
---|
1731 | .TP 8 |
---|
1732 | .B D |
---|
1733 | Device number |
---|
1734 | .TP 8 |
---|
1735 | .B I |
---|
1736 | Inode number |
---|
1737 | .TP 8 |
---|
1738 | .B F |
---|
1739 | Composite \fBf\fRile identifier, in the form \fIdevice\fR:\fIinode\fR |
---|
1740 | .TP 8 |
---|
1741 | .B L |
---|
1742 | The name of the file pointed to by a symbolic link |
---|
1743 | .TP 8 |
---|
1744 | .B N |
---|
1745 | Number of (hard) links |
---|
1746 | .TP 8 |
---|
1747 | .B P |
---|
1748 | Permissions, in octal, without leading zero |
---|
1749 | .TP 8 |
---|
1750 | .B P: |
---|
1751 | Like \fBP\fR, with leading zero |
---|
1752 | .TP 8 |
---|
1753 | .B P\fImode |
---|
1754 | Equivalent to `\-P \fIfile\fR & \fImode\fR', e.g. `\-P22 \fIfile\fR' returns |
---|
1755 | `22' if \fIfile\fR is writable by group and other, `20' if by group only, |
---|
1756 | and `0' if by neither |
---|
1757 | .TP 8 |
---|
1758 | .B P\fImode\fB: |
---|
1759 | Like \fBP\fImode\fB:\fR, with leading zero |
---|
1760 | .TP 8 |
---|
1761 | .B U |
---|
1762 | Numeric userid |
---|
1763 | .TP 8 |
---|
1764 | .B U: |
---|
1765 | Username, or the numeric userid if the username is unknown |
---|
1766 | .TP 8 |
---|
1767 | .B G |
---|
1768 | Numeric groupid |
---|
1769 | .TP 8 |
---|
1770 | .B G: |
---|
1771 | Groupname, or the numeric groupid if the groupname is unknown |
---|
1772 | .TP 8 |
---|
1773 | .B Z |
---|
1774 | Size, in bytes |
---|
1775 | .RE |
---|
1776 | .PD |
---|
1777 | .PP |
---|
1778 | Only one of these operators may appear in a multiple-operator test, and it |
---|
1779 | must be the last. Note that \fBL\fR has a different meaning at the end of and |
---|
1780 | elsewhere in a multiple-operator test. Because `0' is a valid return value |
---|
1781 | for many of these operators, they do not return `0' when they fail: most |
---|
1782 | return `\-1', and \fBF\fR returns `:'. |
---|
1783 | .PP |
---|
1784 | If the shell is compiled with POSIX defined (see the \fBversion\fR shell |
---|
1785 | variable), the result of a file inquiry is based on the permission bits of |
---|
1786 | the file and not on the result of the \fIaccess\fR(2) system call. |
---|
1787 | For example, if one tests a file with \fB\-w\fR whose permissions would |
---|
1788 | ordinarily allow writing but which is on a file system mounted read-only, |
---|
1789 | the test will succeed in a POSIX shell but fail in a non-POSIX shell. |
---|
1790 | .PP |
---|
1791 | File inquiry operators can also be evaluated with the \fIfiletest\fR builtin |
---|
1792 | command (q.v.) (+). |
---|
1793 | .SS Jobs |
---|
1794 | The shell associates a \fIjob\fR with each pipeline. It keeps a table of |
---|
1795 | current jobs, printed by the \fIjobs\fR command, and assigns them small integer |
---|
1796 | numbers. When a job is started asynchronously with `&', the shell prints a |
---|
1797 | line which looks like |
---|
1798 | .IP "" 4 |
---|
1799 | [1] 1234 |
---|
1800 | .PP |
---|
1801 | indicating that the job which was started asynchronously was job number 1 and |
---|
1802 | had one (top-level) process, whose process id was 1234. |
---|
1803 | .PP |
---|
1804 | If you are running a job and wish to do something else you may hit the suspend |
---|
1805 | key (usually `^Z'), |
---|
1806 | which sends a STOP signal to the current job. The shell will then normally |
---|
1807 | indicate that the job has been `Suspended' and print another prompt. |
---|
1808 | If the \fBlistjobs\fR shell variable is set, all jobs will be listed |
---|
1809 | like the \fIjobs\fR builtin command; if it is set to `long' the listing will |
---|
1810 | be in long format, like `jobs \-l'. |
---|
1811 | You can then manipulate the state of the suspended job. |
---|
1812 | You can put it in the |
---|
1813 | ``background'' with the \fIbg\fR command or run some other commands and |
---|
1814 | eventually bring the job back into the ``foreground'' with \fIfg\fR. |
---|
1815 | (See also the \fIrun-fg-editor\fR editor command.) |
---|
1816 | A `^Z' takes effect immediately and is like an interrupt |
---|
1817 | in that pending output and unread input are discarded when it is typed. |
---|
1818 | The \fIwait\fR builtin command causes the shell to wait for all background |
---|
1819 | jobs to complete. |
---|
1820 | .PP |
---|
1821 | The `^]' key sends a delayed suspend signal, which does not generate a STOP |
---|
1822 | signal until a program attempts to \fIread\fR(2) it, to the current job. |
---|
1823 | This can usefully be typed ahead when you have prepared some commands for a |
---|
1824 | job which you wish to stop after it has read them. |
---|
1825 | The `^Y' key performs this function in \fIcsh\fR(1); in \fItcsh\fR, |
---|
1826 | `^Y' is an editing command. (+) |
---|
1827 | .PP |
---|
1828 | A job being run in the background stops if it tries to read from the |
---|
1829 | terminal. Background jobs are normally allowed to produce output, but this can |
---|
1830 | be disabled by giving the command `stty tostop'. If you set this tty option, |
---|
1831 | then background jobs will stop when they try to produce output like they do |
---|
1832 | when they try to read input. |
---|
1833 | .PP |
---|
1834 | There are several ways to refer to jobs in the shell. The character `%' |
---|
1835 | introduces a job name. If you wish to refer to job number 1, you can name it |
---|
1836 | as `%1'. Just naming a job brings it to the foreground; thus `%1' is a synonym |
---|
1837 | for `fg %1', bringing job 1 back into the foreground. Similarly, saying `%1 &' |
---|
1838 | resumes job 1 in the background, just like `bg %1'. A job can also be named |
---|
1839 | by an unambigous prefix of the string typed in to start it: `%ex' would |
---|
1840 | normally restart a suspended \fIex\fR(1) job, if there were only one suspended |
---|
1841 | job whose name began with the string `ex'. It is also possible to say |
---|
1842 | `%?\fIstring\fR' to specify a job whose text contains \fIstring\fR, if there |
---|
1843 | is only one such job. |
---|
1844 | .PP |
---|
1845 | The shell maintains a notion of the current and previous jobs. In output |
---|
1846 | pertaining to jobs, the current job is marked with a `+' and the previous job |
---|
1847 | with a `\-'. The abbreviations `%+', `%', and (by analogy with the syntax of |
---|
1848 | the \fIhistory\fR mechanism) `%%' all refer to the current job, and `%\-' refers |
---|
1849 | to the previous job. |
---|
1850 | .PP |
---|
1851 | The job control mechanism requires that the \fIstty\fR(1) option `new' be set |
---|
1852 | on some systems. It is an artifact from a `new' implementation of the tty |
---|
1853 | driver which allows generation of interrupt characters from the keyboard to |
---|
1854 | tell jobs to stop. See \fIstty\fR(1) and the \fIsetty\fR builtin command for |
---|
1855 | details on setting options in the new tty driver. |
---|
1856 | .SS "Status reporting" |
---|
1857 | The shell learns immediately whenever a process changes state. It normally |
---|
1858 | informs you whenever a job becomes blocked so that no further progress is |
---|
1859 | possible, but only just before it prints a prompt. This is done so that it |
---|
1860 | does not otherwise disturb your work. If, however, you set the shell variable |
---|
1861 | \fBnotify\fR, the shell will notify you immediately of changes of status in |
---|
1862 | background jobs. There is also a shell command \fInotify\fR which marks a |
---|
1863 | single process so that its status changes will be immediately reported. By |
---|
1864 | default \fInotify\fR marks the current process; simply say `notify' after |
---|
1865 | starting a background job to mark it. |
---|
1866 | .PP |
---|
1867 | When you try to leave the shell while jobs are stopped, you will be |
---|
1868 | warned that `You have stopped jobs.' You may use the \fIjobs\fR command to see |
---|
1869 | what they are. If you do this or immediately try to exit again, the shell will |
---|
1870 | not warn you a second time, and the suspended jobs will be terminated. |
---|
1871 | .SS "Automatic, periodic and timed events (+)" |
---|
1872 | There are various ways to run commands and take other actions automatically |
---|
1873 | at various times in the ``life cycle'' of the shell. They are summarized here, |
---|
1874 | and described in detail under the appropriate \fBBuiltin commands\fR, |
---|
1875 | \fBSpecial shell variables\fR and \fBSpecial aliases\fR. |
---|
1876 | .PP |
---|
1877 | The \fIsched\fR builtin command puts commands in a scheduled-event list, |
---|
1878 | to be executed by the shell at a given time. |
---|
1879 | .PP |
---|
1880 | The \fIbeepcmd\fR, \fIcwdcmd\fR, \fIperiodic\fR and \fIprecmd\fR |
---|
1881 | \fBSpecial aliases\fR can be set, respectively, to execute commands when the shell wants |
---|
1882 | to ring the bell, when the working directory changes, every \fBtperiod\fR |
---|
1883 | minutes and before each prompt. |
---|
1884 | .PP |
---|
1885 | The \fBautologout\fR shell variable can be set to log out or lock the shell |
---|
1886 | after a given number of minutes of inactivity. |
---|
1887 | .PP |
---|
1888 | The \fBmail\fR shell variable can be set to check for new mail periodically. |
---|
1889 | .PP |
---|
1890 | The \fBprintexitvalue\fR shell variable can be set to print the exit status |
---|
1891 | of commands which exit with a status other than zero. |
---|
1892 | .PP |
---|
1893 | The \fBrmstar\fR shell variable can be set to ask the user, when `rm *' is |
---|
1894 | typed, if that is really what was meant. |
---|
1895 | .PP |
---|
1896 | The \fBtime\fR shell variable can be set to execute the \fItime\fR builtin |
---|
1897 | command after the completion of any process that takes more than a given |
---|
1898 | number of CPU seconds. |
---|
1899 | .PP |
---|
1900 | The \fBwatch\fR and \fBwho\fR shell variables can be set to report when |
---|
1901 | selected users log in or out, and the \fIlog\fR builtin command reports |
---|
1902 | on those users at any time. |
---|
1903 | .SS "Native Language System support (+)" |
---|
1904 | The shell is eight bit clean |
---|
1905 | (if so compiled; see the \fBversion\fR shell variable) |
---|
1906 | and thus supports character sets needing this capability. |
---|
1907 | NLS support differs depending on whether or not |
---|
1908 | the shell was compiled to use the system's NLS (again, see \fBversion\fR). |
---|
1909 | In either case, 7-bit ASCII is the default for character classification |
---|
1910 | (e.g. which characters are printable) and sorting, |
---|
1911 | and changing the \fBLANG\fR or \fBLC_CTYPE\fR environment variables |
---|
1912 | causes a check for possible changes in these respects. |
---|
1913 | .PP |
---|
1914 | When using the system's NLS, the \fIsetlocale\fR(3) function is called |
---|
1915 | to determine appropriate character classification and sorting. |
---|
1916 | This function typically examines the \fBLANG\fR and \fBLC_CTYPE\fR |
---|
1917 | environment variables; refer to the system documentation for further details. |
---|
1918 | When not using the system's NLS, the shell simulates it by assuming that the |
---|
1919 | ISO 8859-1 character set is used |
---|
1920 | whenever either of the \fBLANG\fR and \fBLC_CTYPE\fR variables are set, regardless of |
---|
1921 | their values. Sorting is not affected for the simulated NLS. |
---|
1922 | .PP |
---|
1923 | In addition, with both real and simulated NLS, all printable |
---|
1924 | characters in the range \e200\-\e377, i.e. those that have |
---|
1925 | M-\fIchar\fR bindings, are automatically rebound to \fIself-insert-command\fR. |
---|
1926 | The corresponding binding for the escape-\fIchar\fR sequence, if any, is |
---|
1927 | left alone. |
---|
1928 | These characters are not rebound if the \fBNOREBIND\fR environment variable |
---|
1929 | is set. This may be useful for the simulated NLS or a primitive real NLS |
---|
1930 | which assumes full ISO 8859-1. Otherwise, all M-\fIchar\fR bindings in the |
---|
1931 | range \e240\-\e377 are effectively undone. |
---|
1932 | Explicitly rebinding the relevant keys with \fIbindkey\fR |
---|
1933 | is of course still possible. |
---|
1934 | .PP |
---|
1935 | Unknown characters (i.e. those that are neither printable nor control |
---|
1936 | characters) are printed in the format \ennn. |
---|
1937 | If the tty is not in 8 bit mode, other 8 bit characters are printed by |
---|
1938 | converting them to ASCII and using standout mode. The shell |
---|
1939 | never changes the 7/8 bit mode of the tty and tracks user-initiated |
---|
1940 | changes of 7/8 bit mode. NLS users (or, for that matter, those who want to |
---|
1941 | use a meta key) may need to explicitly set |
---|
1942 | the tty in 8 bit mode through the appropriate \fIstty\fR(1) |
---|
1943 | command in, e.g., the \fI~/.login\fR file. |
---|
1944 | .SS "OS variant support (+)" |
---|
1945 | A number of new builtin commands are provided to support features in |
---|
1946 | particular operating systems. All are described in detail in the |
---|
1947 | \fBBuiltin commands\fR section. |
---|
1948 | .PP |
---|
1949 | On systems that support TCF (aix-ibm370, aix-ps2), |
---|
1950 | \fIgetspath\fR and \fIsetspath\fR get and set the system execution path, |
---|
1951 | \fIgetxvers\fR and \fIsetxvers\fR get and set the experimental version prefix |
---|
1952 | and \fImigrate\fR migrates processes between sites. The \fIjobs\fR builtin |
---|
1953 | prints the site on which each job is executing. |
---|
1954 | .PP |
---|
1955 | Under Domain/OS, \fIinlib\fR adds shared libraries to the current environment, |
---|
1956 | \fIrootnode\fR changes the rootnode and \fIver\fR changes the systype. |
---|
1957 | .PP |
---|
1958 | Under Mach, \fIsetpath\fR is equivalent to Mach's \fIsetpath\fR(1). |
---|
1959 | .PP |
---|
1960 | Under Masscomp/RTU and Harris CX/UX, \fIuniverse\fR sets the universe. |
---|
1961 | .PP |
---|
1962 | Under Harris CX/UX, \fIucb\fR or \fIatt\fR runs a command under the specified |
---|
1963 | universe. |
---|
1964 | .PP |
---|
1965 | Under Convex/OS, \fIwarp\fR prints or sets the universe. |
---|
1966 | .PP |
---|
1967 | The \fBVENDOR\fR, \fBOSTYPE\fR and \fBMACHTYPE\fR environment variables |
---|
1968 | indicate respectively the vendor, operating system and machine type |
---|
1969 | (microprocessor class or machine model) of the |
---|
1970 | system on which the shell thinks it is running. |
---|
1971 | These are particularly useful when sharing one's home directory between several |
---|
1972 | types of machines; one can, for example, |
---|
1973 | .IP "" 4 |
---|
1974 | set path = (~/bin.$MACHTYPE /usr/ucb /bin /usr/bin .) |
---|
1975 | .PP |
---|
1976 | in one's \fI~/.login\fR and put executables compiled for each machine in the |
---|
1977 | appropriate directory. |
---|
1978 | .PP |
---|
1979 | The \fBversion\fR shell |
---|
1980 | variable indicates what options were chosen when the shell was compiled. |
---|
1981 | .PP |
---|
1982 | Note also the \fInewgrp\fR builtin, the \fBafsuser\fR and |
---|
1983 | \fBecho_style\fR shell variables and the system-dependent locations of |
---|
1984 | the shell's input files (see \fBFILES\fR). |
---|
1985 | .SS "Signal handling" |
---|
1986 | Login shells ignore interrupts when reading the file \fI~/.logout\fR. |
---|
1987 | The shell ignores quit signals unless started with \fB\-q\fR. |
---|
1988 | Login shells catch the terminate signal, but non-login shells inherit the |
---|
1989 | terminate behavior from their parents. |
---|
1990 | Other signals have the values which the shell inherited from its parent. |
---|
1991 | .PP |
---|
1992 | In shell scripts, the shell's handling of interrupt and terminate signals |
---|
1993 | can be controlled with \fIonintr\fR, and its handling of hangups can be |
---|
1994 | controlled with \fIhup\fR and \fInohup\fR. |
---|
1995 | .PP |
---|
1996 | The shell exits on a hangup (see also the \fBlogout\fR shell variable). By |
---|
1997 | default, the shell's children do too, but the shell does not send them a |
---|
1998 | hangup when it exits. \fIhup\fR arranges for the shell to send a hangup to |
---|
1999 | a child when it exits, and \fInohup\fR sets a child to ignore hangups. |
---|
2000 | .SS "Terminal management (+)" |
---|
2001 | The shell uses three different sets of terminal (``tty'') modes: |
---|
2002 | `edit', used when editing, `quote', used when quoting literal characters, |
---|
2003 | and `execute', used when executing commands. |
---|
2004 | The shell holds some settings in each mode constant, so commands which leave |
---|
2005 | the tty in a confused state do not interfere with the shell. |
---|
2006 | The shell also matches changes in the speed and padding of the tty. |
---|
2007 | The list of tty modes that are kept constant |
---|
2008 | can be examined and modified with the \fIsetty\fR builtin. |
---|
2009 | Note that although the editor uses CBREAK mode (or its equivalent), |
---|
2010 | it takes typed-ahead characters anyway. |
---|
2011 | .PP |
---|
2012 | The \fIechotc\fR, \fIsettc\fR and \fItelltc\fR commands can be used to |
---|
2013 | manipulate and debug terminal capabilities from the command line. |
---|
2014 | .PP |
---|
2015 | On systems that support SIGWINCH or SIGWINDOW, the shell |
---|
2016 | adapts to window resizing automatically and adjusts the environment |
---|
2017 | variables \fBLINES\fR and \fBCOLUMNS\fR if set. If the environment |
---|
2018 | variable \fBTERMCAP\fR contains li# and co# fields, the shell adjusts |
---|
2019 | them to reflect the new window size. |
---|
2020 | .SH REFERENCE |
---|
2021 | The next sections of this manual describe all of the available |
---|
2022 | \fBBuiltin commands\fR, \fBSpecial aliases\fR and |
---|
2023 | \fBSpecial shell variables\fR. |
---|
2024 | .SS "Builtin commands" |
---|
2025 | .TP 8 |
---|
2026 | .B %\fIjob |
---|
2027 | A synonym for the \fIfg\fR builtin command. |
---|
2028 | .TP 8 |
---|
2029 | .B %\fIjob \fB& |
---|
2030 | A synonym for the \fIbg\fR builtin command. |
---|
2031 | .TP 8 |
---|
2032 | .B : |
---|
2033 | Does nothing, successfully. |
---|
2034 | .PP |
---|
2035 | .B @ |
---|
2036 | .br |
---|
2037 | .B @ \fIname\fB = \fIexpr |
---|
2038 | .br |
---|
2039 | .B @ \fIname\fR[\fIindex\fR]\fB = \fIexpr |
---|
2040 | .br |
---|
2041 | .B @ \fIname\fB++\fR|\fB-- |
---|
2042 | .PD 0 |
---|
2043 | .TP 8 |
---|
2044 | .B @ \fIname\fR[\fIindex\fR]\fB++\fR|\fB-- |
---|
2045 | The first form prints the values of all shell variables. |
---|
2046 | .PD |
---|
2047 | .RS +8 |
---|
2048 | .PP |
---|
2049 | The second form assigns the value of \fIexpr\fR to \fIname\fR. |
---|
2050 | The third form assigns the value of \fIexpr\fR to the \fIindex\fR'th |
---|
2051 | component of \fIname\fR; both \fIname\fR and its \fIindex\fR'th component |
---|
2052 | must already exist. |
---|
2053 | .PP |
---|
2054 | \fIexpr\fR may contain the operators `*', `+', etc. as in C. |
---|
2055 | If \fIexpr\fR contains `<', `>', `&' or `' then at least that part of |
---|
2056 | \fIexpr\fR must be placed within `()'. |
---|
2057 | Note that the syntax of \fIexpr\fR has nothing to do with that described |
---|
2058 | under \fBExpressions\fR. |
---|
2059 | .PP |
---|
2060 | The fourth and fifth forms increment (`++') or decrement (`\-\-') \fIname\fR |
---|
2061 | or its \fIindex\fR'th component. |
---|
2062 | .PP |
---|
2063 | The space between `@' and \fIname\fR is required. The spaces between |
---|
2064 | \fIname\fR and `=' and between `=' and \fIexpr\fR are optional. Components of |
---|
2065 | \fIexpr\fR must be separated by spaces. |
---|
2066 | .RE |
---|
2067 | .PD |
---|
2068 | .TP 8 |
---|
2069 | .B alias \fR[\fIname \fR[\fIwordlist\fR]] |
---|
2070 | Without arguments, prints all aliases. |
---|
2071 | With \fIname\fR, prints the alias for name. |
---|
2072 | With \fIname\fR and \fIwordlist\fR, assigns |
---|
2073 | \fIwordlist\fR as the alias of \fIname\fR. |
---|
2074 | \fIwordlist\fR is command and filename substituted. |
---|
2075 | \fIname\fR may not be `alias' or `unalias'. |
---|
2076 | See also the \fIunalias\fR builtin command. |
---|
2077 | .ig \" Obsolete tcsh command |
---|
2078 | .TP 8 |
---|
2079 | .B aliases \fR[\fIfile\fR] (+) |
---|
2080 | Without arguments, prints all aliases. |
---|
2081 | With \fIfile\fR, loads a list of aliases from \fIfile\fR, one per line. |
---|
2082 | Retained only for downward compatibility. |
---|
2083 | .. |
---|
2084 | .TP 8 |
---|
2085 | .B alloc |
---|
2086 | Shows the amount of dynamic memory acquired, broken down into used and free |
---|
2087 | memory. With an argument shows the number of free and used blocks in each size |
---|
2088 | category. The categories start at size 8 and double at each step. This |
---|
2089 | command's output may vary across system types, since systems other than the VAX |
---|
2090 | may use a different memory allocator. |
---|
2091 | .TP 8 |
---|
2092 | .B bg \fR[\fB%\fIjob\fR ...] |
---|
2093 | Puts the specified jobs (or, without arguments, the current job) |
---|
2094 | into the background, continuing each if it is stopped. |
---|
2095 | \fIjob\fR may be a number, a string, `', `%', `+' or `\-' as described |
---|
2096 | under \fBJobs\fR. |
---|
2097 | .ig \" Obsolete tcsh command |
---|
2098 | .TP 8 |
---|
2099 | .B bind \fR[\fBdefaults\fR|\fBemacs\fR|\fBvi\fR|\fIkey\fR|\fIkey command\fR] (+) |
---|
2100 | An older version of \fIbindkey\fR, retained only for downward compatibility. |
---|
2101 | Without arguments, lists all bound keys and the editor command to which each is bound. |
---|
2102 | `bind defaults', `bind emacs' and `bind vi' are equivalent to |
---|
2103 | `bindkey \-d', `bindkey \-e' and `bindkey \-v'. |
---|
2104 | With \fIkey\fR, lists the editor command to which \fIkey\fR is bound. |
---|
2105 | With \fIkey\fR and \fIcommand\fR, binds the editor command \fIcommand\fR to \fIkey\fR. |
---|
2106 | .IP "" 8 |
---|
2107 | \fIkey\fR may be a literal character, |
---|
2108 | a control character written ^\fIcharacter\fR (e.g. `^A'), |
---|
2109 | a meta character written M-\fIcharacter\fR (e.g. `M-A') |
---|
2110 | or a function key written F-\fIstring\fR (e.g. `F-foo'). |
---|
2111 | For the function key form to work, the function key prefix must be |
---|
2112 | bound to \fIsequence-lead-in\fR and \fIstring\fR must not contain that prefix. |
---|
2113 | .. |
---|
2114 | .PP |
---|
2115 | .B bindkey \fR[\fB\-l\fR|\fB\-d\fR|\fB\-e\fR|\fB\-v\fR|\fB\-u\fR] (+) |
---|
2116 | .br |
---|
2117 | \fBbindkey \fR[\fB\-a\fR] [\fB\-b\fR] [\fB\-k\fR] [\fB\-r\fR] [\fB\-\-\fR] \fIkey \fR(+) |
---|
2118 | .PD 0 |
---|
2119 | .TP 8 |
---|
2120 | \fBbindkey \fR[\fB\-a\fR] [\fB\-b\fR] [\fB\-k\fR] [\fB\-c\fR|\fB\-s\fR] [\fB\-\-\fR] \fIkey command \fR(+) |
---|
2121 | .\" .B macro can't take too many words, so I used \fB in the previous tags |
---|
2122 | Without options, the first form lists all bound keys and the editor command to which each is bound, |
---|
2123 | the second form lists the editor command to which \fIkey\fR is bound and |
---|
2124 | the third form binds the editor command \fIcommand\fR to \fIkey\fR. |
---|
2125 | Options include: |
---|
2126 | .PD |
---|
2127 | .PP |
---|
2128 | .PD 0 |
---|
2129 | .RS +8 |
---|
2130 | .TP 4 |
---|
2131 | .B \-l |
---|
2132 | Lists all editor commands and a short description of each. |
---|
2133 | .TP 4 |
---|
2134 | .B \-d |
---|
2135 | Binds all keys to the standard bindings for the default editor. |
---|
2136 | .TP 4 |
---|
2137 | .B \-e |
---|
2138 | Binds all keys to the standard GNU Emacs-like bindings. |
---|
2139 | .TP 4 |
---|
2140 | .B \-v |
---|
2141 | Binds all keys to the standard \fIvi\fR(1)-like bindings. |
---|
2142 | .TP 4 |
---|
2143 | .B \-a |
---|
2144 | Lists or changes key-bindings in the alternative key map. |
---|
2145 | This is the key map used in \fIvi\fR command mode. |
---|
2146 | .TP 4 |
---|
2147 | .B \-b |
---|
2148 | \fIkey\fR is interpreted as |
---|
2149 | a control character written ^\fIcharacter\fR (e.g. `^A') or |
---|
2150 | C-\fIcharacter\fR (e.g. `C-A'), |
---|
2151 | a meta character written M-\fIcharacter\fR (e.g. `M-A'), |
---|
2152 | a function key written F-\fIstring\fR (e.g. `F-string'), |
---|
2153 | or an extended prefix key written X-\fIcharacter\fR (e.g. `X-A'). |
---|
2154 | .TP 4 |
---|
2155 | .B \-k |
---|
2156 | \fIkey\fR is interpreted as a symbolic arrow key name, which may be one of |
---|
2157 | `down', `up', `left' or `right'. |
---|
2158 | .TP 4 |
---|
2159 | .B \-r |
---|
2160 | Removes \fIkey\fR's binding. |
---|
2161 | Be careful: `bindkey \-r' does \fInot\fR bind \fIkey\fR to |
---|
2162 | \fIself-insert-command\fR (q.v.), it unbinds \fIkey\fR completely. |
---|
2163 | .TP 4 |
---|
2164 | .B \-c |
---|
2165 | \fIcommand\fR is interpreted as a builtin or external command instead of an |
---|
2166 | editor command. |
---|
2167 | .TP 4 |
---|
2168 | .B \-s |
---|
2169 | \fIcommand\fR is taken as a literal string and treated as terminal input |
---|
2170 | when \fIkey\fR is typed. Bound keys in \fIcommand\fR are themselves |
---|
2171 | reinterpreted, and this continues for ten levels of interpretation. |
---|
2172 | .TP 4 |
---|
2173 | .B \-\- |
---|
2174 | Forces a break from option processing, so the next word is taken as \fIkey\fR |
---|
2175 | even if it begins with '\-'. |
---|
2176 | .TP 4 |
---|
2177 | .B \-u \fR(or any invalid option) |
---|
2178 | Prints a usage message. |
---|
2179 | .PD |
---|
2180 | .PP |
---|
2181 | \fIkey\fR may be a single character or a string. |
---|
2182 | If a command is bound to a string, the first character of the string is bound to |
---|
2183 | \fIsequence-lead-in\fR and the entire string is bound to the command. |
---|
2184 | .PP |
---|
2185 | Control characters in \fIkey\fR can be literal (they can be typed by preceding |
---|
2186 | them with the editor command \fIquoted-insert\fR, normally bound to `^V') or |
---|
2187 | written caret-character style, e.g. `^A'. Delete is written `^?' |
---|
2188 | (caret-question mark). \fIkey\fR and \fIcommand\fR can contain backslashed |
---|
2189 | escape sequences (in the style of System V \fIecho\fR(1)) as follows: |
---|
2190 | .RS +4 |
---|
2191 | .TP 8 |
---|
2192 | .PD 0 |
---|
2193 | .B \ea |
---|
2194 | Bell |
---|
2195 | .TP 8 |
---|
2196 | .B \eb |
---|
2197 | Backspace |
---|
2198 | .TP 8 |
---|
2199 | .B \ee |
---|
2200 | Escape |
---|
2201 | .TP 8 |
---|
2202 | .B \ef |
---|
2203 | Form feed |
---|
2204 | .TP 8 |
---|
2205 | .B \en |
---|
2206 | Newline |
---|
2207 | .TP 8 |
---|
2208 | .B \er |
---|
2209 | Carriage return |
---|
2210 | .TP 8 |
---|
2211 | .B \et |
---|
2212 | Horizontal tab |
---|
2213 | .TP 8 |
---|
2214 | .B \ev |
---|
2215 | Vertical tab |
---|
2216 | .TP 8 |
---|
2217 | .B \e\fInnn |
---|
2218 | The ASCII character corresponding to the octal number \fInnn\fR |
---|
2219 | .PD |
---|
2220 | .RE |
---|
2221 | .PP |
---|
2222 | `\e' nullifies the special meaning of the following character, if it has |
---|
2223 | any, notably `\\' and `^'. |
---|
2224 | .RE |
---|
2225 | .TP 8 |
---|
2226 | .B break |
---|
2227 | Causes execution to resume after the \fIend\fR of the nearest |
---|
2228 | enclosing \fIforeach\fR or \fIwhile\fR. The remaining commands on the |
---|
2229 | current line are executed. Multi-level breaks are thus |
---|
2230 | possible by writing them all on one line. |
---|
2231 | .TP 8 |
---|
2232 | .B breaksw |
---|
2233 | Causes a break from a \fIswitch\fR, resuming after the \fIendsw\fR. |
---|
2234 | .TP 8 |
---|
2235 | .B builtins \fR(+) |
---|
2236 | Prints the names of all builtin commands. |
---|
2237 | .TP 8 |
---|
2238 | .B bye \fR(+) |
---|
2239 | A synonym for the \fIlogout\fR builtin command. |
---|
2240 | Available only if the shell was so compiled; |
---|
2241 | see the \fBversion\fR shell variable. |
---|
2242 | .TP 8 |
---|
2243 | .B case \fIlabel\fB: |
---|
2244 | A label in a \fIswitch\fR statement as discussed below. |
---|
2245 | .TP 8 |
---|
2246 | .B cd \fR[\fB\-p\fR] [\fB\-l\fR] [\fB\-n\fR|\fB\-v\fR] [\fIname\fR] |
---|
2247 | If a directory \fIname\fR is given, changes the shell's working directory |
---|
2248 | to \fIname\fR. If not, changes to \fBhome\fR. |
---|
2249 | If \fIname\fR is `\-' it is interpreted as the previous working directory |
---|
2250 | (see \fBOther substitutions\fR). (+) |
---|
2251 | If \fIname\fR is not a subdirectory of the current directory |
---|
2252 | (and does not begin with `/', `./' or `../'), each component of the variable |
---|
2253 | \fBcdpath\fR is checked to see if it has a subdirectory \fIname\fR. Finally, if |
---|
2254 | all else fails but \fIname\fR is a shell variable whose value |
---|
2255 | begins with `/', then this is tried to see if it is a directory. |
---|
2256 | .RS +8 |
---|
2257 | .PP |
---|
2258 | With \fB\-p\fR, prints the final directory stack, just like \fIdirs\fR. |
---|
2259 | The \fB\-l\fR, \fB\-n\fR and \fB\-v\fR flags have the same effect on \fIcd\fR |
---|
2260 | as on \fIdirs\fR, and they imply \fB\-p\fR. (+) |
---|
2261 | .PP |
---|
2262 | See also the \fBimplicitcd\fR shell variable. |
---|
2263 | .RE |
---|
2264 | .TP 8 |
---|
2265 | .B chdir |
---|
2266 | A synonym for the \fIcd\fR builtin command. |
---|
2267 | .TP 8 |
---|
2268 | .B complete \fR[\fIcommand\fR [\fIword\fB/\fIpattern\fB/\fIlist\fR[\fB:\fIselect\fR]\fB/\fR[[\fIsuffix\fR]\fB/\fR] ...]] (+) |
---|
2269 | Without arguments, lists all completions. |
---|
2270 | With \fIcommand\fR, lists completions for \fIcommand\fR. |
---|
2271 | With \fIcommand\fR and \fIword\fR etc., defines completions. |
---|
2272 | .RS +8 |
---|
2273 | .PP |
---|
2274 | \fIcommand\fR may be a full command name or a glob-pattern |
---|
2275 | (see \fBFilename substitution\fR). It can begin with `\-' to indicate that |
---|
2276 | completion should be used only when \fIcommand\fR is ambiguous. |
---|
2277 | .PP |
---|
2278 | \fIword\fR specifies which word relative to the current word |
---|
2279 | is to be completed, and may be one of the following: |
---|
2280 | .PP |
---|
2281 | .PD 0 |
---|
2282 | .RS +4 |
---|
2283 | .TP 4 |
---|
2284 | .B c |
---|
2285 | Current-word completion. |
---|
2286 | \fIpattern\fR is a glob-pattern which must match the beginning of the current word on |
---|
2287 | the command line. \fIpattern\fR is ignored when completing the current word. |
---|
2288 | .TP 4 |
---|
2289 | .B C |
---|
2290 | Like \fBc\fR, but includes \fIpattern\fR when completing the current word. |
---|
2291 | .TP 4 |
---|
2292 | .B n |
---|
2293 | Next-word completion. |
---|
2294 | \fIpattern\fR is a glob-pattern which must match the beginning of the previous word on |
---|
2295 | the command line. |
---|
2296 | .TP 4 |
---|
2297 | .B N |
---|
2298 | Like \fBn\fR, but must match the beginning of the word two before the current word. |
---|
2299 | .TP 4 |
---|
2300 | .B p |
---|
2301 | Position-dependent completion. |
---|
2302 | \fIpattern\fR is a numeric range, with the same syntax used to index shell |
---|
2303 | variables, which must include the current word. |
---|
2304 | .PD |
---|
2305 | .RE |
---|
2306 | .ig \" No longer true in 6.05.04 |
---|
2307 | .PP |
---|
2308 | When \fIpattern\fR is a glob-pattern (for \fBc\fR, \fBC\fR, \fBn\fR and |
---|
2309 | \fBN\fR-type completion), a \fIpattern\fR of `*' does not match an empty |
---|
2310 | word. |
---|
2311 | .. |
---|
2312 | .PP |
---|
2313 | \fIlist\fR, the list of possible completions, may be one of the following: |
---|
2314 | .PP |
---|
2315 | .PD 0 |
---|
2316 | .RS +4 |
---|
2317 | .TP 8 |
---|
2318 | .B a |
---|
2319 | Aliases |
---|
2320 | .TP 8 |
---|
2321 | .B b |
---|
2322 | Bindings (editor commands) |
---|
2323 | .TP 8 |
---|
2324 | .B c |
---|
2325 | Commands (builtin or external commands) |
---|
2326 | .TP 8 |
---|
2327 | .B C |
---|
2328 | External commands which begin with the supplied path prefix |
---|
2329 | .TP 8 |
---|
2330 | .B d |
---|
2331 | Directories |
---|
2332 | .TP 8 |
---|
2333 | .B D |
---|
2334 | Directories which begin with the supplied path prefix |
---|
2335 | .TP 8 |
---|
2336 | .B e |
---|
2337 | Environment variables |
---|
2338 | .TP 8 |
---|
2339 | .B f |
---|
2340 | Filenames |
---|
2341 | .TP 8 |
---|
2342 | .B F |
---|
2343 | Filenames which begin with the supplied path prefix |
---|
2344 | .TP 8 |
---|
2345 | .B g |
---|
2346 | Groupnames |
---|
2347 | .TP 8 |
---|
2348 | .B j |
---|
2349 | Jobs |
---|
2350 | .TP 8 |
---|
2351 | .B l |
---|
2352 | Limits |
---|
2353 | .TP 8 |
---|
2354 | .B n |
---|
2355 | Nothing |
---|
2356 | .TP 8 |
---|
2357 | .B s |
---|
2358 | Shell variables |
---|
2359 | .TP 8 |
---|
2360 | .B S |
---|
2361 | Signals |
---|
2362 | .TP 8 |
---|
2363 | .B t |
---|
2364 | Plain (``text'') files |
---|
2365 | .TP 8 |
---|
2366 | .B T |
---|
2367 | Plain (``text'') files which begin with the supplied path prefix |
---|
2368 | .TP 8 |
---|
2369 | .B v |
---|
2370 | Any variables |
---|
2371 | .TP 8 |
---|
2372 | .B u |
---|
2373 | Usernames |
---|
2374 | .TP 8 |
---|
2375 | .B x |
---|
2376 | Like \fBn\fR, but prints \fIselect\fR when \fIlist-choices\fR is used. |
---|
2377 | .TP 8 |
---|
2378 | .B X |
---|
2379 | Completions |
---|
2380 | .TP 8 |
---|
2381 | $\fIvar\fR |
---|
2382 | Words from the variable \fIvar\fR |
---|
2383 | .TP 8 |
---|
2384 | (...) |
---|
2385 | Words from the given list |
---|
2386 | .TP 8 |
---|
2387 | `...` |
---|
2388 | Words from the output of command |
---|
2389 | .PD |
---|
2390 | .RE |
---|
2391 | .PP |
---|
2392 | \fIselect\fR is an optional glob-pattern. |
---|
2393 | If given, only words from \fIlist\fR which match \fIselect\fR are considered |
---|
2394 | and the \fBfignore\fR shell variable is ignored. |
---|
2395 | The last three types of completion may not have a \fIselect\fR |
---|
2396 | pattern, and \fBx\fR uses \fIselect\fR as an explanatory message when |
---|
2397 | the \fIlist-choices\fR editor command is used. |
---|
2398 | .PP |
---|
2399 | \fIsuffix\fR is a single character to be appended to a successful |
---|
2400 | completion. If null, no character is appended. If omitted (in which |
---|
2401 | case the fourth delimiter can also be omitted), a slash is appended to |
---|
2402 | directories and a space to other words. |
---|
2403 | .PP |
---|
2404 | Now for some examples. Some commands take only directories as arguments, |
---|
2405 | so there's no point completing plain files. |
---|
2406 | .IP "" 4 |
---|
2407 | > complete cd 'p/1/d/' |
---|
2408 | .PP |
---|
2409 | completes only the first word following `cd' (`p/1') with a directory. |
---|
2410 | \fBp\fR-type completion can also be used to narrow down command completion: |
---|
2411 | .IP "" 4 |
---|
2412 | > co[^D] |
---|
2413 | .br |
---|
2414 | complete compress |
---|
2415 | .br |
---|
2416 | > complete \-co* 'p/0/(compress)/' |
---|
2417 | .br |
---|
2418 | > co[^D] |
---|
2419 | .br |
---|
2420 | > compress |
---|
2421 | .PP |
---|
2422 | This completion completes commands (words in position 0, `p/0') |
---|
2423 | which begin with `co' (thus matching `co*') to `compress' (the only |
---|
2424 | word in the list). |
---|
2425 | The leading `\-' indicates that this completion is to be used only with |
---|
2426 | ambiguous commands. |
---|
2427 | .IP "" 4 |
---|
2428 | > complete find 'n/\-user/u/' |
---|
2429 | .PP |
---|
2430 | is an example of \fBn\fR-type completion. Any word following `find' and |
---|
2431 | immediately following `\-user' is completed from the list of users. |
---|
2432 | .IP "" 4 |
---|
2433 | > complete cc 'c/\-I/d/' |
---|
2434 | .PP |
---|
2435 | demonstrates \fBc\fR-type completion. Any word following `cc' and beginning |
---|
2436 | with `\-I' is completed as a directory. `\-I' is not taken as part of the |
---|
2437 | directory because we used lowercase \fBc\fR. |
---|
2438 | .PP |
---|
2439 | Different \fIlist\fRs are useful with different commands. |
---|
2440 | .IP "" 4 |
---|
2441 | > complete alias 'p/1/a/' |
---|
2442 | .br |
---|
2443 | > complete man 'p/*/c/' |
---|
2444 | .br |
---|
2445 | > complete set 'p/1/s/' |
---|
2446 | .br |
---|
2447 | > complete true 'p/1/x:Truth has no options./' |
---|
2448 | .PP |
---|
2449 | These complete words following `alias' with aliases, `man' with commands, |
---|
2450 | and `set' with shell variables. |
---|
2451 | `true' doesn't have any options, so \fBx\fR does nothing when completion |
---|
2452 | is attempted and prints `Truth has no options.' when completion choices are listed. |
---|
2453 | .PP |
---|
2454 | .ig \" Changed in 6.05.04 |
---|
2455 | The \fIman\fR example, and several other examples below, use |
---|
2456 | \fBp\fR-type completion, rather than \fBC\fR- or \fBn\fR-type, so that |
---|
2457 | `*' will match an empty word. |
---|
2458 | .. |
---|
2459 | Note that the \fIman\fR example, and several other examples below, could |
---|
2460 | just as well have used 'c/*' or 'n/*' as 'p/*'. |
---|
2461 | .PP |
---|
2462 | Words can be completed from a variable evaluated at completion time, |
---|
2463 | .IP "" 4 |
---|
2464 | > complete ftp 'p/1/$hostnames/' |
---|
2465 | .br |
---|
2466 | > set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu) |
---|
2467 | .br |
---|
2468 | > ftp [^D] |
---|
2469 | .br |
---|
2470 | rtfm.mit.edu tesla.ee.cornell.edu |
---|
2471 | .br |
---|
2472 | > ftp [^C] |
---|
2473 | .br |
---|
2474 | > set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net) |
---|
2475 | .br |
---|
2476 | > ftp [^D] |
---|
2477 | .br |
---|
2478 | rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net |
---|
2479 | .PP |
---|
2480 | or from a command run at completion time: |
---|
2481 | .IP "" 4 |
---|
2482 | > complete kill 'p/*/`ps | awk \\{print\\ \\$1\\}`/' |
---|
2483 | .br |
---|
2484 | > kill \-9 [^D] |
---|
2485 | .br |
---|
2486 | 23113 23377 23380 23406 23429 23529 23530 PID |
---|
2487 | .PP |
---|
2488 | Note that the \fIcomplete\fR command does not itself quote its arguments, |
---|
2489 | so the braces, space and `$' in `{print $1}' must be quoted explicitly. |
---|
2490 | .PP |
---|
2491 | One command can have multiple completions: |
---|
2492 | .IP "" 4 |
---|
2493 | > complete dbx 'p/2/(core)/' 'p/*/c/' |
---|
2494 | .PP |
---|
2495 | completes the second argument to `dbx' with the word `core' and all other |
---|
2496 | arguments with commands. Note that the positional completion is specified |
---|
2497 | before the next-word completion. |
---|
2498 | Since completions are evaluated from left to right, if |
---|
2499 | the next-word completion were specified first it would always match |
---|
2500 | and the positional completion would never be executed. This is a |
---|
2501 | common mistake when defining a completion. |
---|
2502 | .PP |
---|
2503 | The \fIselect\fR pattern is useful when a command takes only files with |
---|
2504 | particular forms as arguments. For example, |
---|
2505 | .IP "" 4 |
---|
2506 | > complete cc 'p/*/f:*.[cao]/' |
---|
2507 | .PP |
---|
2508 | completes `cc' arguments only to files ending in `.c', `.a', or `.o'. |
---|
2509 | \fIselect\fR can also exclude files, using negation of a glob-pattern as |
---|
2510 | described under \fBFilename substitution\fR. One might use |
---|
2511 | .IP "" 4 |
---|
2512 | > complete rm 'p/*/f:^*.{c,h,cc,C,tex,1,man,l,y}/' |
---|
2513 | .PP |
---|
2514 | to exclude precious source code from `rm' completion. Of course, one |
---|
2515 | could still type excluded names manually or override the completion |
---|
2516 | mechanism using the \fIcomplete-word-raw\fR or \fIlist-choices-raw\fR |
---|
2517 | editor commands (q.v.). |
---|
2518 | .PP |
---|
2519 | The `C', `D', `F' and `T' \fIlist\fRs are like `c', `d', `f' and `t' |
---|
2520 | respectively, but they use the \fIselect\fR argument in a different way: to |
---|
2521 | restrict completion to files beginning with a particular path prefix. For |
---|
2522 | example, the Elm mail program uses `=' as an abbreviation for one's mail |
---|
2523 | directory. One might use |
---|
2524 | .IP "" 4 |
---|
2525 | > complete elm c@=@F:$HOME/Mail/@ |
---|
2526 | .PP |
---|
2527 | to complete `elm \-f =' as if it were `elm \-f ~/Mail/'. Note that we used `@' |
---|
2528 | instead of `/' to avoid confusion with the \fIselect\fR argument, and we used |
---|
2529 | `$HOME' instead of `~' because home directory substitution only works at the |
---|
2530 | beginning of a word. |
---|
2531 | .PP |
---|
2532 | \fIsuffix\fR is used to add a nonstandard suffix |
---|
2533 | (not space or `/' for directories) to completed words. |
---|
2534 | .IP "" 4 |
---|
2535 | > complete finger 'c/*@/$hostnames/' 'p/1/u/@' |
---|
2536 | .PP |
---|
2537 | completes arguments to `finger' from the list of users, appends an `@', |
---|
2538 | and then completes after the `@' from the `hostnames' variable. Note |
---|
2539 | again the order in which the completions are specified. |
---|
2540 | .PP |
---|
2541 | Finally, here's a complex example for inspiration: |
---|
2542 | .IP "" 4 |
---|
2543 | > complete find \\ |
---|
2544 | .br |
---|
2545 | \'n/\-name/f/' 'n/\-newer/f/' 'n/\-{,n}cpio/f/' \e |
---|
2546 | .br |
---|
2547 | \'n/\-exec/c/' 'n/\-ok/c/' 'n/\-user/u/' \e |
---|
2548 | .br |
---|
2549 | \'n/\-group/g/' 'n/\-fstype/(nfs 4.2)/' \e |
---|
2550 | .br |
---|
2551 | \'n/\-type/(b c d f l p s)/' \e |
---|
2552 | .br |
---|
2553 | \'c/\-/(name newer cpio ncpio exec ok user \e |
---|
2554 | .br |
---|
2555 | group fstype type atime ctime depth inum \e |
---|
2556 | .br |
---|
2557 | ls mtime nogroup nouser perm print prune \e |
---|
2558 | .br |
---|
2559 | size xdev)/' \e |
---|
2560 | .br |
---|
2561 | \'p/*/d/' |
---|
2562 | .PP |
---|
2563 | This completes words following `\-name', `\-newer', `\-cpio' or `ncpio' |
---|
2564 | (note the pattern which matches both) to files, |
---|
2565 | words following `\-exec' or `\-ok' to commands, words following `user' |
---|
2566 | and `group' to users and groups respectively |
---|
2567 | and words following `\-fstype' or `\-type' to members of the |
---|
2568 | given lists. It also completes the switches themselves from the given list |
---|
2569 | (note the use of \fBc\fR-type completion) |
---|
2570 | and completes anything not otherwise completed to a directory. Whew. |
---|
2571 | .PP |
---|
2572 | Remember that programmed completions are ignored if the word being completed |
---|
2573 | is a tilde substitution (beginning with `~') or a variable (beginning with `$'). |
---|
2574 | \fIcomplete\fR is an experimental feature, and the syntax may change |
---|
2575 | in future versions of the shell. |
---|
2576 | See also the \fIuncomplete\fR builtin command. |
---|
2577 | .RE |
---|
2578 | .TP 8 |
---|
2579 | .B continue |
---|
2580 | Continues execution of the nearest enclosing \fIwhile\fR or \fIforeach\fR. |
---|
2581 | The rest of the commands on the current line are executed. |
---|
2582 | .TP 8 |
---|
2583 | .B default: |
---|
2584 | Labels the default case in a \fIswitch\fR statement. |
---|
2585 | It should come after all \fIcase\fR labels. |
---|
2586 | .PP |
---|
2587 | .B dirs \fR[\fB\-l\fR] [\fB\-n\fR|\fB\-v\fR] |
---|
2588 | .br |
---|
2589 | .B dirs \-S\fR|\fB\-L \fR[\fIfilename\fR] (+) |
---|
2590 | .PD 0 |
---|
2591 | .TP 8 |
---|
2592 | .B dirs \-c \fR(+) |
---|
2593 | The first form prints the directory stack. The top of the stack is at the |
---|
2594 | left and the first directory in the stack is the current directory. |
---|
2595 | With \fB\-l\fR, `~' or `~\fIname\fP' in the output is expanded explicitly |
---|
2596 | to \fBhome\fR or the pathname of the home directory for user \fIname\fP. (+) |
---|
2597 | With \fB\-n\fR, entries are wrapped before they reach the edge of the screen. (+) |
---|
2598 | With \fB\-v\fR, entries are printed one per line, preceded by their stack postions. (+) |
---|
2599 | If more than one of \fB\-n\fR or \fB\-v\fR is given, \fB\-v\fR takes precedence. |
---|
2600 | \fB\-p\fR is accepted but does nothing. |
---|
2601 | .PD |
---|
2602 | .RS +8 |
---|
2603 | .PP |
---|
2604 | With \fB\-S\fR, the second form saves the directory stack to \fIfilename\fR |
---|
2605 | as a series of \fIcd\fR and \fIpushd\fR commands. |
---|
2606 | With \fB\-L\fR, the shell sources \fIfilename\fR, which is presumably |
---|
2607 | a directory stack file saved by the \fB\-S\fR option or the \fBsavedirs\fR |
---|
2608 | mechanism. |
---|
2609 | In either case, \fBdirsfile\fR is used if \fIfilename\fR is not given and |
---|
2610 | \fI~/.cshdirs\fR is used if \fBdirsfile\fR is unset. |
---|
2611 | .PP |
---|
2612 | Note that login shells do the equivalent of `dirs \-L' on startup |
---|
2613 | and, if \fBsavedirs\fR is set, `dirs \-S' before exiting. |
---|
2614 | Because only \fI~/.tcshrc\fR is normally sourced before \fI~/.cshdirs\fR, |
---|
2615 | \fBdirsfile\fR should be set in \fI~/.tcshrc\fR rather than \fI~/.login\fR. |
---|
2616 | .PP |
---|
2617 | The last form clears the directory stack. |
---|
2618 | .RE |
---|
2619 | .TP 8 |
---|
2620 | .B echo \fR[\fB\-n\fR] \fIword\fR ... |
---|
2621 | Writes each \fIword\fR to the shell's standard |
---|
2622 | output, separated by spaces and terminated with a newline. |
---|
2623 | The \fBecho_style\fR shell variable may be set to emulate (or not) the flags and escape |
---|
2624 | sequences of the BSD and/or System V versions of \fIecho\fR; see \fIecho\fR(1). |
---|
2625 | .TP 8 |
---|
2626 | .B echotc \fR[\fB\-sv\fR] \fIarg\fR ... (+) |
---|
2627 | Exercises the terminal capabilities (see \fItermcap\fR(5)) in \fIargs\fR. |
---|
2628 | For example, 'echotc home' sends the cursor to the home position, |
---|
2629 | \&'echotc cm 3 10' sends it to column 3 and row 10, and |
---|
2630 | \&'echotc ts 0; echo "This is a test."; echotc fs' prints "This is a test." |
---|
2631 | in the status line. |
---|
2632 | .RS +8 |
---|
2633 | .PP |
---|
2634 | If \fIarg\fR is 'baud', 'cols', 'lines', 'meta' or 'tabs', prints the |
---|
2635 | value of that capability ("yes" or "no" indicating that the terminal does |
---|
2636 | or does not have that capability). One might use this to make the output |
---|
2637 | from a shell script less verbose on slow terminals, or limit command |
---|
2638 | output to the number of lines on the screen: |
---|
2639 | .IP "" 4 |
---|
2640 | > set history=`echotc lines` |
---|
2641 | .br |
---|
2642 | > @ history\-\- |
---|
2643 | .PP |
---|
2644 | Termcap strings may contain wildcards which will not echo correctly. |
---|
2645 | One should use double quotes when setting a shell variable to a terminal |
---|
2646 | capability string, as in the following example that places the date in |
---|
2647 | the status line: |
---|
2648 | .IP "" 4 |
---|
2649 | > set tosl="`echotc ts 0`" |
---|
2650 | .br |
---|
2651 | > set frsl="`echotc fs`" |
---|
2652 | .br |
---|
2653 | > echo \-n "$tosl";date; echo \-n "$frsl" |
---|
2654 | .PP |
---|
2655 | With \fB\-s\fR, nonexistent capabilities return the empty string rather |
---|
2656 | than causing an error. |
---|
2657 | With \fB\-v\fR, messages are verbose. |
---|
2658 | .RE |
---|
2659 | .PP |
---|
2660 | .B else |
---|
2661 | .br |
---|
2662 | .B end |
---|
2663 | .br |
---|
2664 | .B endif |
---|
2665 | .PD 0 |
---|
2666 | .TP 8 |
---|
2667 | .B endsw |
---|
2668 | See the description of the \fIforeach\fR, \fIif\fR, \fIswitch\fR, and |
---|
2669 | \fIwhile\fR statements below. |
---|
2670 | .PD |
---|
2671 | .TP 8 |
---|
2672 | .B eval \fIarg\fR ... |
---|
2673 | Treats the arguments as input to the |
---|
2674 | shell and executes the resulting command(s) in the context |
---|
2675 | of the current shell. This is usually used to execute commands |
---|
2676 | generated as the result of command or variable substitution, |
---|
2677 | since parsing occurs before these substitutions. |
---|
2678 | See \fItset\fR(1) for a sample use of \fIeval\fR. |
---|
2679 | .TP 8 |
---|
2680 | .B exec \fIcommand\fR |
---|
2681 | Executes the specified command in place of the current shell. |
---|
2682 | .TP 8 |
---|
2683 | .B exit \fR[\fIexpr\fR] |
---|
2684 | The shell exits either with the value of the specified \fIexpr\fR |
---|
2685 | (an expression, as described under \fBExpressions\fR) |
---|
2686 | or, without \fIexpr\fR, with the value of the \fBstatus\fR variable. |
---|
2687 | .TP 8 |
---|
2688 | .B fg \fR[\fB%\fIjob\fR ...] |
---|
2689 | Brings the specified jobs (or, without arguments, the current job) |
---|
2690 | into the foreground, continuing each if it is stopped. |
---|
2691 | \fIjob\fR may be a number, a string, `', `%', `+' or `\-' as described |
---|
2692 | under \fBJobs\fR. |
---|
2693 | See also the \fIrun-fg-editor\fR editor command. |
---|
2694 | .TP 8 |
---|
2695 | .B filetest \-\fIop file\fR ... (+) |
---|
2696 | Applies \fIop\fR (which is a file inquiry operator as described under |
---|
2697 | \fBFile inquiry operators\fR) to each \fIfile\fR and returns the results as a |
---|
2698 | space-separated list. |
---|
2699 | .PP |
---|
2700 | .B foreach \fIname \fB(\fIwordlist\fB) |
---|
2701 | .br |
---|
2702 | \&... |
---|
2703 | .PD 0 |
---|
2704 | .TP 8 |
---|
2705 | .B end |
---|
2706 | Successively sets the variable \fIname\fR to each member of |
---|
2707 | \fIwordlist\fR and executes the sequence of commands between this command |
---|
2708 | and the matching \fIend\fR. (Both \fIforeach\fR and \fIend\fR |
---|
2709 | must appear alone on separate lines.) The builtin command |
---|
2710 | \fIcontinue\fR may be used to continue the loop prematurely and |
---|
2711 | the builtin command \fIbreak\fR to terminate it prematurely. |
---|
2712 | When this command is read from the terminal, the loop is read once |
---|
2713 | prompting with `foreach? ' (or \fBprompt2\fR) before any statements in |
---|
2714 | the loop are executed. If you make a mistake typing in a |
---|
2715 | loop at the terminal you can rub it out. |
---|
2716 | .PD |
---|
2717 | .TP 8 |
---|
2718 | .B getspath \fR(+) |
---|
2719 | Prints the system execution path. (TCF only) |
---|
2720 | .TP 8 |
---|
2721 | .B getxvers \fR(+) |
---|
2722 | Prints the experimental version prefix. (TCF only) |
---|
2723 | .TP 8 |
---|
2724 | .B glob \fIwordlist |
---|
2725 | Like \fIecho\fR, but no `\\' escapes are recognized and words are |
---|
2726 | delimited by null characters in the output. Useful for |
---|
2727 | programs which wish to use the shell to filename expand a list of words. |
---|
2728 | .TP 8 |
---|
2729 | .B goto \fIword |
---|
2730 | \fIword\fR is filename and command-substituted to |
---|
2731 | yield a string of the form `label'. The shell rewinds its |
---|
2732 | input as much as possible, searches for a line of the |
---|
2733 | form `label:', possibly preceded by blanks or tabs, and |
---|
2734 | continues execution after that line. |
---|
2735 | .TP 8 |
---|
2736 | .B hashstat |
---|
2737 | Prints a statistics line indicating how effective the |
---|
2738 | internal hash table has been at locating commands (and avoiding |
---|
2739 | \fIexec\fR's). An \fIexec\fR is attempted for each component of the |
---|
2740 | \fBpath\fR where the hash function indicates a possible hit, and |
---|
2741 | in each component which does not begin with a `/'. |
---|
2742 | .IP |
---|
2743 | On machines without \fIvfork\fR(2), prints only the number and size of |
---|
2744 | hash buckets. |
---|
2745 | .PP |
---|
2746 | .B history \fR[\fB\-hTr\fR] [\fIn\fR] |
---|
2747 | .br |
---|
2748 | .B history \-S\fR|\fB\-L|\fB\-M \fR[\fIfilename\fR] (+) |
---|
2749 | .PD 0 |
---|
2750 | .TP 8 |
---|
2751 | .B history \-c \fR(+) |
---|
2752 | The first form prints the history event list. |
---|
2753 | If \fIn\fR is given only the \fIn\fR most recent events are printed or saved. |
---|
2754 | With \fB\-h\fR, the history list is printed without leading numbers. If |
---|
2755 | \fB-T\fR is specified, timestamps are printed also in comment form. |
---|
2756 | (This can be used to |
---|
2757 | produce files suitable for loading with 'history \-L' or 'source \-h'.) |
---|
2758 | With \fB\-r\fR, the order of printing is most recent |
---|
2759 | first rather than oldest first. |
---|
2760 | .PD |
---|
2761 | .RS +8 |
---|
2762 | .PP |
---|
2763 | With \fB\-S\fR, the second form saves the history list to \fIfilename\fR. |
---|
2764 | If the first word of the \fBsavehist\fR shell variable is set to a |
---|
2765 | number, at most that many lines are saved. If the second word of |
---|
2766 | \fBsavehist\fR is set to `merge', the history list is merged with the |
---|
2767 | existing history file instead of replacing it (if there is one) and |
---|
2768 | sorted by time stamp. (+) Merging is intended for an environment like |
---|
2769 | the X Window System |
---|
2770 | with several shells in simultaneous use. Currently it only |
---|
2771 | succeeds when the shells quit nicely one after another. |
---|
2772 | .PP |
---|
2773 | With \fB\-L\fR, the shell appends \fIfilename\fR, which is presumably a |
---|
2774 | history list saved by the \fB\-S\fR option or the \fBsavehist\fR mechanism, |
---|
2775 | to the history list. |
---|
2776 | \fB\-M\fR is like \fB\-L\fR, but the contents of \fIfilename\fR are merged |
---|
2777 | into the history list and sorted by timestamp. |
---|
2778 | In either case, \fBhistfile\fR is used if \fIfilename\fR is not given and |
---|
2779 | \fI~/.history\fR is used if \fBhistfile\fR is unset. |
---|
2780 | `history \-L' is exactly like 'source \-h' except that it does not require a |
---|
2781 | filename. |
---|
2782 | .PP |
---|
2783 | Note that login shells do the equivalent of `history \-L' on startup |
---|
2784 | and, if \fBsavehist\fR is set, `history \-S' before exiting. |
---|
2785 | Because only \fI~/.tcshrc\fR is normally sourced before \fI~/.history\fR, |
---|
2786 | \fBhistfile\fR should be set in \fI~/.tcshrc\fR rather than \fI~/.login\fR. |
---|
2787 | .PP |
---|
2788 | If \fBhistlit\fR is set, the first and second forms print and save the literal |
---|
2789 | (unexpanded) form of the history list. |
---|
2790 | .PP |
---|
2791 | The last form clears the history list. |
---|
2792 | .RE |
---|
2793 | .TP 8 |
---|
2794 | .B hup \fR[\fIcommand\fR] \fR(+) |
---|
2795 | With \fIcommand\fR, runs \fIcommand\fR such that it will exit on a hangup |
---|
2796 | signal and arranges for the shell to send it a hangup signal when the shell |
---|
2797 | exits. |
---|
2798 | Note that commands may set their own response to hangups, overriding \fIhup\fR. |
---|
2799 | Without an argument (allowed only in a shell script), causes the shell to |
---|
2800 | exit on a hangup for the remainder of the script. |
---|
2801 | See also \fBSignal handling\fR and the \fInohup\fR builtin command. |
---|
2802 | .TP 8 |
---|
2803 | .B if (\fIexpr\fB) \fIcommand |
---|
2804 | If \fIexpr\fR (an expression, as described under \fBExpressions\fR) |
---|
2805 | evaluates true, then \fIcommand\fR is executed. |
---|
2806 | Variable substitution on \fIcommand\fR happens early, at the same time it |
---|
2807 | does for the rest of the \fIif\fR command. |
---|
2808 | \fIcommand\fR must be a simple command, not an alias, a pipeline, a command list |
---|
2809 | or a parenthesized command list, but it may have arguments. |
---|
2810 | Input/output redirection occurs even if \fIexpr\fR is |
---|
2811 | false and \fIcommand\fR is thus \fInot\fR executed; this is a bug. |
---|
2812 | .PP |
---|
2813 | .B if (\fIexpr\fB) then |
---|
2814 | .br |
---|
2815 | \&... |
---|
2816 | .br |
---|
2817 | .B else if (\fIexpr2\fB) then |
---|
2818 | .br |
---|
2819 | \&... |
---|
2820 | .br |
---|
2821 | .B else |
---|
2822 | .br |
---|
2823 | \&... |
---|
2824 | .PD 0 |
---|
2825 | .TP 8 |
---|
2826 | .B endif |
---|
2827 | If the specified \fIexpr\fR is true then the commands to the |
---|
2828 | first \fIelse\fR are executed; otherwise if \fIexpr2\fR is true then |
---|
2829 | the commands to the second \fIelse\fR are executed, etc. Any |
---|
2830 | number of \fIelse-if\fR pairs are possible; only one \fIendif\fR is |
---|
2831 | needed. The \fIelse\fR part is likewise optional. (The words |
---|
2832 | \fIelse\fR and \fIendif\fR must appear at the beginning of input lines; |
---|
2833 | the \fIif\fR must appear alone on its input line or after an |
---|
2834 | \fIelse\fR.) |
---|
2835 | .PD |
---|
2836 | .TP 8 |
---|
2837 | .B inlib \fIshared-library\fR ... (+) |
---|
2838 | Adds each \fIshared-library\fR to the current environment. There is no way |
---|
2839 | to remove a shared library. (Domain/OS only) |
---|
2840 | .TP 8 |
---|
2841 | .B jobs \fR[\fB\-l\fR] |
---|
2842 | Lists the active jobs. With \fB\-l\fR, lists process |
---|
2843 | IDs in addition to the normal information. On TCF systems, prints |
---|
2844 | the site on which each job is executing. |
---|
2845 | .PP |
---|
2846 | .B kill \fR[\fB\-\fIsignal\fR] \fB%\fIjob\fR|\fIpid\fR ... |
---|
2847 | .PD 0 |
---|
2848 | .TP 8 |
---|
2849 | .B kill \-l |
---|
2850 | The first form sends the specified \fIsignal\fR (or, if none is given, |
---|
2851 | the TERM (terminate) signal) to the specified jobs or processes. |
---|
2852 | \fIjob\fR may be a number, a string, `', `%', `+' or `\-' as described |
---|
2853 | under \fBJobs\fR. |
---|
2854 | Signals are either given by number or by name (as given in |
---|
2855 | \fI/usr/include/signal.h\fR, stripped of the prefix `SIG'). |
---|
2856 | There is no default \fIjob\fR; saying just `kill' does not send a signal |
---|
2857 | to the current job. If the signal being sent is TERM (terminate) |
---|
2858 | or HUP (hangup), then the job or process is sent a |
---|
2859 | CONT (continue) signal as well. |
---|
2860 | The second form lists the signal names. |
---|
2861 | .PD |
---|
2862 | .ig \" Obsolete tcsh command |
---|
2863 | .TP 8 |
---|
2864 | .B linedit \fR(+) |
---|
2865 | A synonym for the \fIecho\fR builtin command. |
---|
2866 | .. |
---|
2867 | .TP 8 |
---|
2868 | .B limit \fR[\fB\-h\fR] [\fIresource\fR [\fImaximum-use\fR]] |
---|
2869 | Limits the consumption by the current process and each |
---|
2870 | process it creates to not individually exceed \fImaximum-use\fR on |
---|
2871 | the specified \fIresource\fR. If no \fImaximum-use\fR is given, then |
---|
2872 | the current limit is printed; if no \fIresource\fR is given, then |
---|
2873 | all limitations are given. If the \fB\-h\fR flag is given, the |
---|
2874 | hard limits are used instead of the current limits. The |
---|
2875 | hard limits impose a ceiling on the values of the current |
---|
2876 | limits. Only the super-user may raise the hard limits, but |
---|
2877 | a user may lower or raise the current limits within the legal range. |
---|
2878 | .RS +8 |
---|
2879 | .PP |
---|
2880 | Controllable resources currently include \fIcputime\fR (the |
---|
2881 | maximum number of cpu-seconds to be used by each process), |
---|
2882 | \fIfilesize\fR (the largest single file which can be created), |
---|
2883 | \fIdatasize\fR (the maximum growth of the data+stack region via |
---|
2884 | sbrk(2) beyond the end of the program text), \fIstacksize\fR (the |
---|
2885 | maximum size of the automatically-extended stack region), |
---|
2886 | \fIcoredumpsize\fR (the size of the largest core dump that will be created), |
---|
2887 | and \fImemoryuse\fR, the maximum amount of physical memory a process |
---|
2888 | may have allocated to it at a given time. |
---|
2889 | .PP |
---|
2890 | \fImaximum-use\fR may be given as a (floating point or |
---|
2891 | integer) number followed by a scale factor. For all limits |
---|
2892 | other than \fIcputime\fR the default scale is `k' or `kilobytes' |
---|
2893 | (1024 bytes); a scale factor of `m' or `megabytes' may also |
---|
2894 | be used. For \fIcputime\fR the default scaling is `seconds', |
---|
2895 | while `m' for minutes or `h' for hours, or a time of the |
---|
2896 | form `mm:ss' giving minutes and seconds may be used. |
---|
2897 | .PP |
---|
2898 | For both \fIresource\fR names and scale factors, unambiguous |
---|
2899 | prefixes of the names suffice. |
---|
2900 | .RE |
---|
2901 | .TP 8 |
---|
2902 | .B log \fR(+) |
---|
2903 | Prints the \fBwatch\fR shell variable and reports on each user indicated |
---|
2904 | in \fBwatch\fR who is logged in, regardless of when they last logged in. |
---|
2905 | See also \fIwatchlog\fR. |
---|
2906 | .TP 8 |
---|
2907 | .B login |
---|
2908 | Terminates a login shell, replacing it with an instance of |
---|
2909 | \fI/bin/login.\fR This is one way to log off, included for |
---|
2910 | compatibility with \fIsh\fR(1). |
---|
2911 | .TP 8 |
---|
2912 | .B logout |
---|
2913 | Terminates a login shell. Especially useful if \fBignoreeof\fR is set. |
---|
2914 | .TP 8 |
---|
2915 | .B ls\-F \fR[\-\fIswitch\fR ...] [\fIfile\fR ...] (+) |
---|
2916 | Lists files like `ls \-F', but much faster. It identifies each type of |
---|
2917 | special file in the listing with a special character: |
---|
2918 | .PP |
---|
2919 | .RS +8 |
---|
2920 | .PD 0 |
---|
2921 | .TP 4 |
---|
2922 | / |
---|
2923 | Directory |
---|
2924 | .TP 4 |
---|
2925 | * |
---|
2926 | Executable |
---|
2927 | .TP 4 |
---|
2928 | # |
---|
2929 | Block device |
---|
2930 | .TP 4 |
---|
2931 | % |
---|
2932 | Character device |
---|
2933 | .TP 4 |
---|
2934 | | |
---|
2935 | Named pipe (systems with named pipes only) |
---|
2936 | .TP 4 |
---|
2937 | = |
---|
2938 | Socket (systems with sockets only) |
---|
2939 | .TP 4 |
---|
2940 | @ |
---|
2941 | Symbolic link (systems with symbolic links only) |
---|
2942 | .TP 4 |
---|
2943 | + |
---|
2944 | Hidden directory (AIX only) or context dependent (HP/UX only) |
---|
2945 | .TP 4 |
---|
2946 | : |
---|
2947 | Network special (HP/UX only) |
---|
2948 | .PD |
---|
2949 | .PP |
---|
2950 | If the \fBlistlinks\fR shell variable is set, symbolic links are identified |
---|
2951 | in more detail (only, of course, on systems which have them): |
---|
2952 | .PP |
---|
2953 | .PD 0 |
---|
2954 | .TP 4 |
---|
2955 | @ |
---|
2956 | Symbolic link to a non-directory |
---|
2957 | .TP 4 |
---|
2958 | > |
---|
2959 | Symbolic link to a directory |
---|
2960 | .TP 4 |
---|
2961 | & |
---|
2962 | Symbolic link to nowhere |
---|
2963 | .PD |
---|
2964 | .PP |
---|
2965 | \fBlistlinks\fR also slows down \fIls\-F\fR and causes partitions holding |
---|
2966 | files pointed to by symbolic links to be mounted. |
---|
2967 | .PP |
---|
2968 | If the \fBlistflags\fR shell variable is set to `x', `a' or `A', or any |
---|
2969 | combination thereof (e.g. `xA'), they are used as flags to \fIls\-F\fR, |
---|
2970 | making it act like `ls \-xF', `ls \-Fa', `ls \-FA' or a combination |
---|
2971 | (e.g. `ls \-FxA'). |
---|
2972 | On machines where `ls \-C' is not the default, \fIls\-F\fR acts like `ls \-CF', |
---|
2973 | unless \fBlistflags\fR contains an `x', in which case it acts like `ls \-xF'. |
---|
2974 | \fIls\-F\fR passes its arguments to \fIls\fR(1) if it is given any switches, |
---|
2975 | so `alias ls ls\-F' generally does the right thing. |
---|
2976 | .PP |
---|
2977 | The \fBls\-F\fR builtin can list files using different colors depending on the |
---|
2978 | filetype or extension. See the \fBcolor\fR \fItcsh\fR variable and the |
---|
2979 | \fBLS_COLORS\fR environment variable. |
---|
2980 | .RE |
---|
2981 | .PP |
---|
2982 | .B migrate \fR[\fB\-\fIsite\fR] \fIpid\fR|\fB%\fIjobid\fR ... (+) |
---|
2983 | .PD 0 |
---|
2984 | .TP 8 |
---|
2985 | .B migrate \-\fIsite\fR (+) |
---|
2986 | The first form migrates the process or job to the site specified or the |
---|
2987 | default site determined by the system path. |
---|
2988 | The second form is equivalent to `migrate \-\fIsite\fR $$': it migrates the |
---|
2989 | current process to the specified site. Migrating the shell |
---|
2990 | itself can cause unexpected behavior, since the shell |
---|
2991 | does not like to lose its tty. (TCF only) |
---|
2992 | .PD |
---|
2993 | .TP 8 |
---|
2994 | .B newgrp \fR[\fB\-\fR] \fIgroup\fR (+) |
---|
2995 | Equivalent to `exec newgrp'; see \fInewgrp\fR(1). |
---|
2996 | Available only if the shell was so compiled; |
---|
2997 | see the \fBversion\fR shell variable. |
---|
2998 | .TP 8 |
---|
2999 | .B nice \fR[\fB+\fInumber\fR] [\fIcommand\fR] |
---|
3000 | Sets the scheduling priority for the shell to \fInumber\fR, or, without |
---|
3001 | \fInumber\fR, to 4. With \fIcommand\fR, runs \fIcommand\fR at the appropriate |
---|
3002 | priority. |
---|
3003 | The greater the \fInumber\fR, the less cpu |
---|
3004 | the process gets. The super-user may specify negative |
---|
3005 | priority by using `nice \-number ...'. Command is always |
---|
3006 | executed in a sub-shell, and the restrictions placed on |
---|
3007 | commands in simple \fIif\fR statements apply. |
---|
3008 | .TP 8 |
---|
3009 | .B nohup \fR[\fIcommand\fR] |
---|
3010 | With \fIcommand\fR, runs \fIcommand\fR such that it will ignore hangup signals. |
---|
3011 | Note that commands may set their own response to hangups, overriding \fInohup\fR. |
---|
3012 | Without an argument (allowed only in a shell script), causes the shell to |
---|
3013 | ignore hangups for the remainder of the script. |
---|
3014 | See also \fBSignal handling\fR and the \fIhup\fR builtin command. |
---|
3015 | .TP 8 |
---|
3016 | .B notify \fR[\fB%\fIjob\fR ...] |
---|
3017 | Causes the shell to notify the user asynchronously when the status of any |
---|
3018 | of the specified jobs (or, without %\fIjob\fR, the current job) changes, |
---|
3019 | instead of waiting until the next prompt as is usual. |
---|
3020 | \fIjob\fR may be a number, a string, `', `%', `+' or `\-' as described |
---|
3021 | under \fBJobs\fR. |
---|
3022 | See also the \fBnotify\fR shell variable. |
---|
3023 | .TP 8 |
---|
3024 | .B onintr \fR[\fB\-\fR|\fIlabel\fR] |
---|
3025 | Controls the action of the shell on interrupts. Without arguments, |
---|
3026 | restores the default action of the shell on interrupts, |
---|
3027 | which is to terminate shell scripts or to return to the |
---|
3028 | terminal command input level. |
---|
3029 | With `\-', causes all interrupts to be ignored. |
---|
3030 | With \fIlabel\fR, causes the shell to execute a `goto \fIlabel\fR' |
---|
3031 | when an interrupt is received or a child process terminates because it was |
---|
3032 | interrupted. |
---|
3033 | .IP "" 8 |
---|
3034 | \fIonintr\fR is ignored if the shell is running detached and in system |
---|
3035 | startup files (see \fBFILES\fR), where interrupts are disabled anyway. |
---|
3036 | .TP 8 |
---|
3037 | .B popd \fR[\fB\-p\fR] [\fB\-l\fR] [\fB\-n\fR|\fB\-v\fR] \fR[\fB+\fIn\fR] |
---|
3038 | Without arguments, pops the directory stack and returns to the new top directory. |
---|
3039 | With a number `+\fIn\fR', discards the \fIn\fR'th entry in the stack. |
---|
3040 | .IP "" 8 |
---|
3041 | Finally, all forms of \fIpopd\fR print the final directory stack, |
---|
3042 | just like \fIdirs\fR. The \fBpushdsilent\fR shell variable can be set to |
---|
3043 | prevent this and the \fB\-p\fR flag can be given to override \fBpushdsilent\fR. |
---|
3044 | The \fB\-l\fR, \fB\-n\fR and \fB\-v\fR flags have the same effect on \fIpopd\fR |
---|
3045 | as on \fIdirs\fR. (+) |
---|
3046 | .TP 8 |
---|
3047 | .B printenv \fR[\fIname\fR] (+) |
---|
3048 | Prints the names and values of all environment variables or, |
---|
3049 | with \fIname\fR, the value of the environment variable \fIname\fR. |
---|
3050 | .TP 8 |
---|
3051 | .B pushd \fR[\fB\-p\fR] [\fB\-l\fR] [\fB\-n\fR|\fB\-v\fR] [\fIname\fR|\fB+\fIn\fR] |
---|
3052 | Without arguments, exchanges the top two elements of the directory stack. |
---|
3053 | If \fBpushdtohome\fR is set, \fIpushd\fR without arguments does `pushd ~', |
---|
3054 | like \fIcd\fR. (+) |
---|
3055 | With \fIname\fR, pushes the current working directory onto the directory |
---|
3056 | stack and changes to \fIname\fR. |
---|
3057 | If \fIname\fR is `\-' it is interpreted as the previous working directory |
---|
3058 | (see \fBFilename substitution\fR). (+) |
---|
3059 | If \fBdunique\fR is set, \fIpushd\fR removes any instances of \fIname\fR |
---|
3060 | from the stack before pushing it onto the stack. (+) |
---|
3061 | With a number `+\fIn\fR', rotates the \fIn\fRth element of the |
---|
3062 | directory stack around to be the top element and changes to it. |
---|
3063 | If \fBdextract\fR is set, however, `pushd +\fIn\fR' extracts the \fIn\fRth |
---|
3064 | directory, pushes it onto the top of the stack and changes to it. (+) |
---|
3065 | .IP "" 8 |
---|
3066 | Finally, all forms of \fIpushd\fR print the final directory stack, |
---|
3067 | just like \fIdirs\fR. The \fBpushdsilent\fR shell variable can be set to |
---|
3068 | prevent this and the \fB\-p\fR flag can be given to override \fBpushdsilent\fR. |
---|
3069 | The \fB\-l\fR, \fB\-n\fR and \fB\-v\fR flags have the same effect on \fIpushd\fR |
---|
3070 | as on \fIdirs\fR. (+) |
---|
3071 | .TP 8 |
---|
3072 | .B rehash |
---|
3073 | Causes the internal hash table of the contents of the |
---|
3074 | directories in the \fBpath\fR variable to be recomputed. This is |
---|
3075 | needed if new commands are added to directories in \fBpath\fR |
---|
3076 | while you are logged in. This should only be necessary if |
---|
3077 | you add commands to one of your own directories, or if a |
---|
3078 | systems programmer changes the contents of one of the |
---|
3079 | system directories. Also flushes the cache of home directories |
---|
3080 | built by tilde expansion. |
---|
3081 | .TP 8 |
---|
3082 | .B repeat \fIcount command |
---|
3083 | The specified \fIcommand\fR, |
---|
3084 | which is subject to the same restrictions as the \fIcommand\fR |
---|
3085 | in the one line \fIif\fR statement above, is executed \fIcount\fR times. |
---|
3086 | I/O redirections occur exactly once, even if \fIcount\fR is 0. |
---|
3087 | .TP 8 |
---|
3088 | .B rootnode //\fInodename \fR(+) |
---|
3089 | Changes the rootnode to //\fInodename\fR, so that `/' will be interpreted |
---|
3090 | as `//\fInodename\fR'. (Domain/OS only) |
---|
3091 | .PP |
---|
3092 | .B sched \fR(+) |
---|
3093 | .br |
---|
3094 | .B sched \fR[\fB+\fR]\fIhh:mm command\fR \fR(+) |
---|
3095 | .PD 0 |
---|
3096 | .TP 8 |
---|
3097 | .B sched \-\fIn\fR (+) |
---|
3098 | The first form prints the scheduled-event list. |
---|
3099 | The \fBsched\fR shell variable may be set to define the format in which |
---|
3100 | the scheduled-event list is printed. |
---|
3101 | The second form adds \fIcommand\fR to the scheduled-event list. |
---|
3102 | For example, |
---|
3103 | .PD |
---|
3104 | .RS +8 |
---|
3105 | .IP "" 4 |
---|
3106 | > sched 11:00 echo It\\'s eleven o\\'clock. |
---|
3107 | .PP |
---|
3108 | causes the shell to echo `It's eleven o'clock.' at 11 AM. |
---|
3109 | The time may be in 12-hour AM/PM format |
---|
3110 | .IP "" 4 |
---|
3111 | > sched 5pm set prompt='[%h] It\\'s after 5; go home: >' |
---|
3112 | .PP |
---|
3113 | or may be relative to the current time: |
---|
3114 | .IP "" 4 |
---|
3115 | > sched +2:15 /usr/lib/uucp/uucico \-r1 \-sother |
---|
3116 | .PP |
---|
3117 | A relative time specification may not use AM/PM format. |
---|
3118 | The third form removes item \fIn\fR from the event list: |
---|
3119 | .IP "" 4 |
---|
3120 | > sched |
---|
3121 | .br |
---|
3122 | 1 Wed Apr 4 15:42 /usr/lib/uucp/uucico \-r1 \-sother |
---|
3123 | .br |
---|
3124 | 2 Wed Apr 4 17:00 set prompt=[%h] It's after 5; go home: > |
---|
3125 | .br |
---|
3126 | > sched \-2 |
---|
3127 | .br |
---|
3128 | > sched |
---|
3129 | .br |
---|
3130 | 1 Wed Apr 4 15:42 /usr/lib/uucp/uucico \-r1 \-sother |
---|
3131 | .PP |
---|
3132 | A command in the scheduled-event list is executed just before the first |
---|
3133 | prompt is printed after the time when the command is scheduled. |
---|
3134 | It is possible to miss the exact time when the command is to be run, but |
---|
3135 | an overdue command will execute at the next prompt. |
---|
3136 | A command which comes due while the shell |
---|
3137 | is waiting for user input is executed immediately. |
---|
3138 | However, normal operation of an already-running command will not |
---|
3139 | be interrupted so that a scheduled-event list element may be run. |
---|
3140 | .PP |
---|
3141 | This mechanism is similar to, but not the same as, the \fIat\fR(1) |
---|
3142 | command on some Unix systems. |
---|
3143 | Its major disadvantage is that it may not run a command at exactly the |
---|
3144 | specified time. |
---|
3145 | Its major advantage is that because \fIsched\fR runs directly from |
---|
3146 | the shell, it has access to shell variables and other structures. |
---|
3147 | This provides a mechanism for changing one's working environment |
---|
3148 | based on the time of day. |
---|
3149 | .RE |
---|
3150 | .PP |
---|
3151 | .B set |
---|
3152 | .br |
---|
3153 | .B set \fIname\fR ... |
---|
3154 | .br |
---|
3155 | .B set \fIname\fR\fB=\fIword\fR ... |
---|
3156 | .br |
---|
3157 | .B set [\-r] [\-f|\-l] \fIname\fR\fB=(\fIwordlist\fB)\fR ... (+) |
---|
3158 | .br |
---|
3159 | .B set \fIname[index]\fR\fB=\fIword\fR ... |
---|
3160 | .br |
---|
3161 | .B set \-r \fR(+) |
---|
3162 | .br |
---|
3163 | .B set \-r \fIname\fR ... (+) |
---|
3164 | .PD 0 |
---|
3165 | .TP 8 |
---|
3166 | .B set \-r \fIname\fR\fB=\fIword\fR ... (+) |
---|
3167 | The first form of the command prints the value of all shell variables. |
---|
3168 | Variables which contain more than a single word print as a |
---|
3169 | parenthesized word list. |
---|
3170 | The second form sets \fIname\fR to the null string. |
---|
3171 | The third form sets \fIname\fR to the single \fIword\fR. |
---|
3172 | The fourth form sets \fIname\fR to the list of words in |
---|
3173 | \fIwordlist\fR. In all cases the value is command and filename expanded. |
---|
3174 | If \-r is specified, the value is set read-only. If \-f or \-l are |
---|
3175 | specified, set only unique words keeping their order. |
---|
3176 | \-f prefers the first occurrence of a word, and \-l the last. |
---|
3177 | first occurance of the word |
---|
3178 | The fifth form sets the \fIindex\fR'th component of name to \fIword\fR; |
---|
3179 | this component must already exist. |
---|
3180 | The sixth form lists the names (only) of all shell variables which are read-only. |
---|
3181 | The seventh form makes \fIname\fR read-only, whether or not it has a value. |
---|
3182 | The second form sets \fIname\fR to the null string. |
---|
3183 | The eighth form is the same as the third form, but |
---|
3184 | make \fIname\fR read-only at the same time. |
---|
3185 | .PD |
---|
3186 | .IP "" 8 |
---|
3187 | These arguments can be repeated to set and/or make read-only multiple variables |
---|
3188 | in a single set command. Note, however, that variable expansion |
---|
3189 | happens for all arguments before any setting occurs. Note also that `=' can |
---|
3190 | be adjacent to both \fIname\fR and \fIword\fR or separated from both by |
---|
3191 | whitespace, but cannot be adjacent to only one or the other. |
---|
3192 | See also the \fIunset\fR builtin command. |
---|
3193 | .TP 8 |
---|
3194 | .B setenv \fR[\fIname \fR[\fIvalue\fR]] |
---|
3195 | Without arguments, prints the names and values of all environment variables. |
---|
3196 | Given \fIname\fR, sets the environment variable \fIname\fR to \fIvalue\fR |
---|
3197 | or, without \fIvalue\fR, to the null string. |
---|
3198 | .TP 8 |
---|
3199 | .B setpath \fIpath \fR(+) |
---|
3200 | Equivalent to \fIsetpath\fR(1). (Mach only) |
---|
3201 | .TP 8 |
---|
3202 | .B setspath\fR LOCAL|\fIsite\fR|\fIcpu\fR ... (+) |
---|
3203 | Sets the system execution path. (TCF only) |
---|
3204 | .TP 8 |
---|
3205 | .B settc \fIcap value \fR(+) |
---|
3206 | Tells the shell to believe that the terminal capability \fIcap\fR |
---|
3207 | (as defined in \fItermcap\fR(5)) has the value \fIvalue\fR. |
---|
3208 | No sanity checking is done. |
---|
3209 | Concept terminal users may have to `settc xn no' to get proper |
---|
3210 | wrapping at the rightmost column. |
---|
3211 | .TP 8 |
---|
3212 | .B setty \fR[\fB\-d\fR|\fB\-q\fR|\fB\-x\fR] [\fB\-a\fR] [[\fB+\fR|\fB\-\fR]\fImode\fR] (+) |
---|
3213 | Controls which tty modes (see \fBTerminal management\fR) |
---|
3214 | the shell does not allow to change. |
---|
3215 | \fB\-d\fR, \fB\-q\fR or \fB\-x\fR tells \fIsetty\fR to act |
---|
3216 | on the `edit', `quote' or `execute' set of tty modes respectively; without |
---|
3217 | \fB\-d\fR, \fB\-q\fR or \fB\-x\fR, `execute' is used. |
---|
3218 | .IP "" 8 |
---|
3219 | Without other arguments, \fIsetty\fR lists the modes in the chosen set |
---|
3220 | which are fixed on (`+mode') or off (`\-mode'). |
---|
3221 | The available modes, and thus the display, vary from system to system. |
---|
3222 | With \fB\-a\fR, lists all tty modes in the chosen set |
---|
3223 | whether or not they are fixed. |
---|
3224 | With \fB+\fImode\fR, \fB\-\fImode\fR or \fImode\fR, fixes \fImode\fR on or off |
---|
3225 | or removes control from \fImode\fR in the chosen set. |
---|
3226 | For example, `setty +echok echoe' fixes `echok' mode on and allows commands |
---|
3227 | to turn `echoe' mode on or off, both when the shell is executing commands. |
---|
3228 | .TP 8 |
---|
3229 | .B setxvers\fR [\fIstring\fR] (+) |
---|
3230 | Set the experimental version prefix to \fIstring\fR, or removes it |
---|
3231 | if \fIstring\fR is omitted. (TCF only) |
---|
3232 | .TP 8 |
---|
3233 | .B shift \fR[\fIvariable\fR] |
---|
3234 | Without arguments, discards \fBargv\fR[1] and shifts the members of |
---|
3235 | \fBargv\fR to the left. It is an error for \fBargv\fR not to be set or to have |
---|
3236 | less than one word as value. With \fIvariable\fR, performs the |
---|
3237 | same function on \fIvariable\fR. |
---|
3238 | .TP 8 |
---|
3239 | .B source \fR[\fB\-h\fR] \fIname\fR [\fIargs\fR ...] |
---|
3240 | The shell reads and executes commands from \fIname\fR. |
---|
3241 | The commands are not placed on the history list. |
---|
3242 | If any \fIargs\fR are given, they are placed in \fBargv\fR. (+) |
---|
3243 | \fIsource\fR commands may be nested; |
---|
3244 | if they are nested too deeply the shell may run out of file descriptors. |
---|
3245 | An error in a \fIsource\fR at any level terminates all nested |
---|
3246 | \fIsource\fR commands. |
---|
3247 | With \fB\-h\fR, commands are placed on the history list instead of being |
---|
3248 | executed, much like `history \-L'. |
---|
3249 | .TP 8 |
---|
3250 | .B stop \fB%\fIjob\fR|\fIpid\fR ... |
---|
3251 | Stops the specified jobs or processes which are executing in the background. |
---|
3252 | \fIjob\fR may be a number, a string, `', `%', `+' or `\-' as described |
---|
3253 | under \fBJobs\fR. |
---|
3254 | There is no default \fIjob\fR; saying just `stop' does not stop |
---|
3255 | the current job. |
---|
3256 | .TP 8 |
---|
3257 | .B suspend |
---|
3258 | Causes the shell to stop in its tracks, much as if it had |
---|
3259 | been sent a stop signal with \fB^Z\fR. This is most often used to |
---|
3260 | stop shells started by \fIsu\fR(1). |
---|
3261 | .PP |
---|
3262 | .B switch (\fIstring\fB) |
---|
3263 | .br |
---|
3264 | .B case \fIstr1\fB: |
---|
3265 | .PD 0 |
---|
3266 | .IP "" 4 |
---|
3267 | \&... |
---|
3268 | .br |
---|
3269 | .B breaksw |
---|
3270 | .PP |
---|
3271 | \&... |
---|
3272 | .PP |
---|
3273 | .B default: |
---|
3274 | .IP "" 4 |
---|
3275 | \&... |
---|
3276 | .br |
---|
3277 | .B breaksw |
---|
3278 | .TP 8 |
---|
3279 | .B endsw |
---|
3280 | Each case label is successively matched, against the |
---|
3281 | specified \fIstring\fR which is first command and filename expanded. |
---|
3282 | The file metacharacters `*', `?' and `[...]' may be used |
---|
3283 | in the case labels, which are variable expanded. If none |
---|
3284 | of the labels match before a `default' label is found, then |
---|
3285 | the execution begins after the default label. Each case |
---|
3286 | label and the default label must appear at the beginning of |
---|
3287 | a line. The command \fIbreaksw\fR causes execution to continue |
---|
3288 | after the \fIendsw\fR. Otherwise control may fall through case |
---|
3289 | labels and default labels as in C. If no label matches and |
---|
3290 | there is no default, execution continues after the \fIendsw\fR. |
---|
3291 | .PD |
---|
3292 | .TP 8 |
---|
3293 | .B telltc \fR(+) |
---|
3294 | Lists the values of all terminal capabilities (see \fItermcap\fR(5)). |
---|
3295 | .TP 8 |
---|
3296 | .B time \fR[\fIcommand\fR] |
---|
3297 | Executes \fIcommand\fR (which must be a simple command, not an alias, |
---|
3298 | a pipeline, a command list or a parenthesized command list) |
---|
3299 | and prints a time summary as described under the \fBtime\fR variable. |
---|
3300 | If necessary, an extra shell is created to print the time statistic when |
---|
3301 | the command completes. |
---|
3302 | Without \fIcommand\fR, prints a time summary for the current shell and its |
---|
3303 | children. |
---|
3304 | .TP 8 |
---|
3305 | .B umask \fR[\fIvalue\fR] |
---|
3306 | Sets the file creation mask to \fIvalue\fR, which is given in octal. |
---|
3307 | Common values for the mask are |
---|
3308 | 002, giving all access to the group and read and execute access to others, and |
---|
3309 | 022, giving read and execute access to the group and others. |
---|
3310 | Without \fIvalue\fR, prints the current file creation mask. |
---|
3311 | .TP 8 |
---|
3312 | .B unalias \fIpattern |
---|
3313 | .br |
---|
3314 | Removes all aliases whose names match \fIpattern\fR. |
---|
3315 | `unalias *' thus removes all aliases. |
---|
3316 | It is not an error for nothing to be \fIunalias\fRed. |
---|
3317 | .TP 8 |
---|
3318 | .B uncomplete \fIpattern\fR (+) |
---|
3319 | Removes all completions whose names match \fIpattern\fR. |
---|
3320 | `uncomplete *' thus removes all completions. |
---|
3321 | It is not an error for nothing to be \fIuncomplete\fRd. |
---|
3322 | .TP 8 |
---|
3323 | .B unhash |
---|
3324 | Disables use of the internal hash table to speed location of |
---|
3325 | executed programs. |
---|
3326 | .TP 8 |
---|
3327 | .B universe \fIuniverse\fR (+) |
---|
3328 | Sets the universe to \fIuniverse\fR. (Masscomp/RTU only) |
---|
3329 | .TP 8 |
---|
3330 | .B unlimit \fR[\fB\-h\fR] [\fIresource\fR] |
---|
3331 | Removes the limitation on \fIresource\fR or, if no \fIresource\fR is |
---|
3332 | specified, all \fIresource\fR limitations. |
---|
3333 | With \fB\-h\fR, the corresponding hard limits are removed. |
---|
3334 | Only the super-user may do this. |
---|
3335 | .TP 8 |
---|
3336 | .B unset \fIpattern |
---|
3337 | Removes all variables whose names match \fIpattern\fR, unless they are read-only. |
---|
3338 | `unset *' thus removes all variables unless they are read-only; |
---|
3339 | this is a bad idea. |
---|
3340 | It is not an error for nothing to be \fIunset\fR. |
---|
3341 | .TP 8 |
---|
3342 | .B unsetenv \fIpattern |
---|
3343 | Removes all environment variables whose names match \fIpattern\fR. |
---|
3344 | `unsetenv *' thus removes all environment variables; |
---|
3345 | this is a bad idea. |
---|
3346 | It is not an error for nothing to be \fIunsetenv\fRed. |
---|
3347 | .TP 8 |
---|
3348 | .B ver \fR[\fIsystype\fR [\fIcommand\fR]] (+) |
---|
3349 | Without arguments, prints \fBSYSTYPE\fR. With \fIsystype\fR, sets \fBSYSTYPE\fR |
---|
3350 | to \fIsystype\fR. With \fIsystype\fR and \fIcommand\fR, executes \fIcommand\fR |
---|
3351 | under \fIsystype\fR. \fIsystype\fR may be `bsd4.3' or `sys5.3'. |
---|
3352 | (Domain/OS only) |
---|
3353 | .TP 8 |
---|
3354 | .B wait |
---|
3355 | The shell waits for all background jobs. If the shell is interactive, an |
---|
3356 | interrupt will disrupt the wait and cause the shell to print the names and job |
---|
3357 | numbers of all outstanding jobs. |
---|
3358 | .TP 8 |
---|
3359 | .B warp \fIuniverse\fR (+) |
---|
3360 | Sets the universe to \fIuniverse\fR. (Convex/OS only) |
---|
3361 | .TP 8 |
---|
3362 | .B watchlog \fR(+) |
---|
3363 | An alternate name for the \fIlog\fR builtin command (q.v.). |
---|
3364 | Available only if the shell was so compiled; |
---|
3365 | see the \fBversion\fR shell variable. |
---|
3366 | .TP 8 |
---|
3367 | .B where \fIcommand\fR (+) |
---|
3368 | Reports all known instances of \fIcommand\fR, including aliases, builtins and |
---|
3369 | executables in \fBpath\fR. |
---|
3370 | .TP 8 |
---|
3371 | .B which\fR \fIcommand\fR (+) |
---|
3372 | Displays the command that will be executed by the shell after substitutions, |
---|
3373 | \fBpath\fR searching, etc. |
---|
3374 | The builtin command is just like \fIwhich\fR(1), but it correctly reports |
---|
3375 | \fItcsh\fR aliases and builtins and is 10 to 100 times faster. |
---|
3376 | See also the \fIwhich-command\fR editor command. |
---|
3377 | .PP |
---|
3378 | .B while (\fIexpr\fB)\fR |
---|
3379 | .br |
---|
3380 | \&... |
---|
3381 | .PD 0 |
---|
3382 | .TP 8 |
---|
3383 | .B end |
---|
3384 | Executes the commands between the \fIwhile\fR and the matching \fIend\fR |
---|
3385 | while \fIexpr\fR (an expression, as described under \fBExpressions\fR) |
---|
3386 | evaluates non-zero. |
---|
3387 | \fIwhile\fR and \fIend\fR must appear alone on their input lines. |
---|
3388 | \fIbreak\fR and \fIcontinue\fR may be used to terminate or continue the |
---|
3389 | loop prematurely. |
---|
3390 | If the input is a terminal, the user is prompted the first time |
---|
3391 | through the loop as with \fIforeach\fR. |
---|
3392 | .PD |
---|
3393 | .SS "Special aliases (+)" |
---|
3394 | If set, each of these aliases executes automatically at the indicated time. |
---|
3395 | They are all initially undefined. |
---|
3396 | .TP 8 |
---|
3397 | .B beepcmd |
---|
3398 | Runs when the shell wants to ring the terminal bell. |
---|
3399 | .TP 8 |
---|
3400 | .B cwdcmd |
---|
3401 | Runs after every change of working directory. For example, if the user is |
---|
3402 | working on an X window system using \fIxterm\fR(1) and a re-parenting window |
---|
3403 | manager that supports title bars such as \fItwm\fR(1) and does |
---|
3404 | .RS +8 |
---|
3405 | .IP "" 4 |
---|
3406 | > alias cwdcmd 'echo \-n "^[]2;${HOST}:$cwd ^G"' |
---|
3407 | .PP |
---|
3408 | then the shell will change the title of the running \fIxterm\fR(1) |
---|
3409 | to be the name of the host, a colon, and the full current working directory. |
---|
3410 | A fancier way to do that is |
---|
3411 | .IP "" 4 |
---|
3412 | > alias cwdcmd 'echo \-n "^[]2;${HOST}:$cwd^G^[]1;${HOST}^G"' |
---|
3413 | .PP |
---|
3414 | This will put the hostname and working directory on the title bar but |
---|
3415 | only the hostname in the icon manager menu. |
---|
3416 | .PP |
---|
3417 | Note that putting a \fIcd\fR, \fIpushd\fR or \fIpopd\fR in \fIcwdcmd\fR |
---|
3418 | may cause an infinite loop. It is the author's opinion that anyone doing |
---|
3419 | so will get what they deserve. |
---|
3420 | .RE |
---|
3421 | .TP 8 |
---|
3422 | .B periodic |
---|
3423 | Runs every \fBtperiod\fR minutes. This provides a convenient means for |
---|
3424 | checking on common but infrequent changes such as new mail. For example, |
---|
3425 | if one does |
---|
3426 | .RS +8 |
---|
3427 | .IP "" 4 |
---|
3428 | > set tperiod = 30 |
---|
3429 | .br |
---|
3430 | > alias periodic checknews |
---|
3431 | .PP |
---|
3432 | then the \fIchecknews\fR(1) program runs every 30 minutes. |
---|
3433 | If \fIperiodic\fR is set but \fBtperiod\fR is unset or set to 0, |
---|
3434 | \fIperiodic\fR behaves like \fIprecmd\fR. |
---|
3435 | .RE |
---|
3436 | .TP 8 |
---|
3437 | .B precmd |
---|
3438 | Runs just before each prompt is printed. For example, if one does |
---|
3439 | .RS +8 |
---|
3440 | .IP "" 4 |
---|
3441 | > alias precmd date |
---|
3442 | .PP |
---|
3443 | then \fIdate\fR(1) runs just before the shell prompts for each command. |
---|
3444 | There are no limits on what \fIprecmd\fR can be set to do, but discretion |
---|
3445 | should be used. |
---|
3446 | .RE |
---|
3447 | .TP 8 |
---|
3448 | .B shell |
---|
3449 | Specifies the interpreter for executable scripts which do not themselves |
---|
3450 | specify an interpreter. The first word should be a full path name to the |
---|
3451 | desired interpreter (e.g. `/bin/csh' or `/usr/local/bin/tcsh'). |
---|
3452 | .SS "Special shell variables" |
---|
3453 | The variables described in this section have special meaning to the shell. |
---|
3454 | .PP |
---|
3455 | The shell sets \fBaddsuffix\fR, \fBargv\fR, \fBautologout\fR, \fBcommand\fR, \fBecho_style\fR, |
---|
3456 | \fBedit\fR, \fBgid\fR, \fBgroup\fR, \fBhome\fR, \fBloginsh\fR, \fBoid\fR, \fBpath\fR, |
---|
3457 | \fBprompt\fR, \fBprompt2\fR, \fBprompt3\fR, \fBshell\fR, \fBshlvl\fR, |
---|
3458 | \fBtcsh\fR, \fBterm\fR, \fBtty\fR, \fBuid\fR, \fBuser\fR and \fBversion\fR at |
---|
3459 | startup; they do not change thereafter unless changed by the user. The shell |
---|
3460 | updates \fBcwd\fR, \fBdirstack\fR, \fBowd\fR and \fBstatus\fR when necessary, |
---|
3461 | and sets \fBlogout\fR on logout. |
---|
3462 | .PP |
---|
3463 | The shell synchronizes \fBafsuser\fR, \fBgroup\fR, \fBhome\fR, \fBpath\fR, \fBshlvl\fR, |
---|
3464 | \fBterm\fR and \fBuser\fR with the environment variables of the same names: |
---|
3465 | whenever the environment variable changes the shell changes the corresponding |
---|
3466 | shell variable to match (unless the shell variable is read-only) and vice |
---|
3467 | versa. Note that although \fBcwd\fR and \fBPWD\fR have identical meanings, they |
---|
3468 | are not synchronized in this manner, and that the shell automatically |
---|
3469 | interconverts the different formats of \fBpath\fR and \fBPATH\fR. |
---|
3470 | .TP 8 |
---|
3471 | .B addsuffix \fR(+) |
---|
3472 | If set, filename completion adds `/' to the end of directories and a space |
---|
3473 | to the end of normal files when they are matched exactly. |
---|
3474 | Set by default. |
---|
3475 | .TP 8 |
---|
3476 | .B afsuser \fR(+) |
---|
3477 | If set, \fBautologout\fR's autolock feature uses its value instead of |
---|
3478 | the local username for kerberos authentication. |
---|
3479 | .TP 8 |
---|
3480 | .B ampm \fR(+) |
---|
3481 | If set, all times are shown in 12-hour AM/PM format. |
---|
3482 | .TP 8 |
---|
3483 | .B argv |
---|
3484 | The arguments to the shell. Positional parameters are taken from \fBargv\fR, |
---|
3485 | i.e. `$1' is replaced by `$argv[1]', etc. |
---|
3486 | Set by default, but usually empty in interactive shells. |
---|
3487 | .TP 8 |
---|
3488 | .B autocorrect \fR(+) |
---|
3489 | If set, the \fIspell-word\fR editor command is invoked automatically before |
---|
3490 | each completion attempt. |
---|
3491 | .TP 8 |
---|
3492 | .B autoexpand \fR(+) |
---|
3493 | If set, the \fIexpand-history\fR editor command is invoked automatically |
---|
3494 | before each completion attempt. |
---|
3495 | .TP 8 |
---|
3496 | .B autolist \fR(+) |
---|
3497 | If set, possibilities are listed after an ambiguous completion. |
---|
3498 | If set to `ambiguous', possibilities are listed only when no new |
---|
3499 | characters are added by completion. |
---|
3500 | .TP 8 |
---|
3501 | .B autologout \fR(+) |
---|
3502 | The first word is the number of minutes of inactivity before automatic |
---|
3503 | logout. The optional second word is the number of minutes of inactivity |
---|
3504 | before automatic locking. |
---|
3505 | When the shell automatically logs out, |
---|
3506 | it prints `auto-logout', sets the variable logout to `automatic' and exits. |
---|
3507 | When the shell automatically locks, the user is required to enter his password |
---|
3508 | to continue working. Five incorrect attempts result in automatic logout. |
---|
3509 | Set to `60' (automatic logout after 60 minutes, and no locking) by default |
---|
3510 | in login and superuser shells, but not if the shell thinks it is running |
---|
3511 | under a window system (i.e. the \fBDISPLAY\fR environment variable is set), |
---|
3512 | the tty is a pseudo-tty (pty) or the shell was not so compiled (see the |
---|
3513 | \fBversion\fR shell variable). |
---|
3514 | See also the \fBafsuser\fR and \fBlogout\fR shell variables. |
---|
3515 | .TP 8 |
---|
3516 | .B backslash_quote \fR(+) |
---|
3517 | If set, backslashes (`\\') always quote `\\', `'', and `"'. This may make |
---|
3518 | complex quoting tasks easier, but it can cause syntax errors in \fIcsh\fR(1) |
---|
3519 | scripts. |
---|
3520 | .TP 8 |
---|
3521 | .B cdpath |
---|
3522 | A list of directories in which \fIcd\fR should search for |
---|
3523 | subdirectories if they aren't found in the current directory. |
---|
3524 | .TP 8 |
---|
3525 | .B color |
---|
3526 | If set, it enables color display for the builtin \fBls\-F\fR and it passes |
---|
3527 | \fB\-\-color=auto\fR to \fBls\fR. Alternatively, it can be set to only |
---|
3528 | \fBls\-F\fR or only \fBls\fR to enable color only to one command. Setting |
---|
3529 | it to nothing is equivalent to setting it to \fB(ls\-F ls)\fR. |
---|
3530 | .TP 8 |
---|
3531 | .B command \fR(+) |
---|
3532 | If set, the command which was passed to the shell with the \fB-c\fR flag (q.v.). |
---|
3533 | .TP 8 |
---|
3534 | .B complete \fR(+) |
---|
3535 | If set to `enhance', completion 1) ignores case and 2) considers |
---|
3536 | periods, hyphens and underscores (`.', `\-' and `_') to be word |
---|
3537 | separators and hyphens and underscores to be equivalent. |
---|
3538 | .TP 8 |
---|
3539 | .B correct \fR(+) |
---|
3540 | If set to `cmd', commands are automatically spelling-corrected. |
---|
3541 | If set to `complete', commands are automatically completed. |
---|
3542 | If set to `all', the entire command line is corrected. |
---|
3543 | .TP 8 |
---|
3544 | .B cwd |
---|
3545 | The full pathname of the current directory. |
---|
3546 | See also the \fBdirstack\fR and \fBowd\fR shell variables. |
---|
3547 | .TP 8 |
---|
3548 | .B dextract \fR(+) |
---|
3549 | If set, `pushd +\fIn\fR' extracts the \fIn\fRth directory from the directory |
---|
3550 | stack rather than rotating it to the top. |
---|
3551 | .TP 8 |
---|
3552 | .B dirsfile \fR(+) |
---|
3553 | The default location in which `dirs \-S' and `dirs \-L' look for |
---|
3554 | a history file. If unset, \fI~/.cshdirs\fR is used. |
---|
3555 | Because only \fI~/.tcshrc\fR is normally sourced before \fI~/.cshdirs\fR, |
---|
3556 | \fBdirsfile\fR should be set in \fI~/.tcshrc\fR rather than \fI~/.login\fR. |
---|
3557 | .TP 8 |
---|
3558 | .B dirstack \fR(+) |
---|
3559 | An array of all the directories on the directory stack. |
---|
3560 | `$dirstack[1]' is the current working directory, `$dirstack[2]' |
---|
3561 | the first directory on the stack, etc. |
---|
3562 | Note that the current working directory is `$dirstack[1]' but `=0' in |
---|
3563 | directory stack substitutions, etc. |
---|
3564 | One can change the stack arbitrarily by setting \fBdirstack\fR, |
---|
3565 | but the first element (the current working directory) is always correct. |
---|
3566 | See also the \fBcwd\fR and \fBowd\fR shell variables. |
---|
3567 | .TP 8 |
---|
3568 | .B dspmbyte \fR(+) |
---|
3569 | If set to `euc', it enables display and editing EUC-kanji(japanese) code. |
---|
3570 | If set to `sjis', it enables display and editing Shift-JIS(japanese) code. |
---|
3571 | If set to following format, it enables display and editing original multi-byte code format: |
---|
3572 | .RS +8 |
---|
3573 | .IP "" 4 |
---|
3574 | > set dspkanji = 0000....(256 bytes)....0000 |
---|
3575 | .PP |
---|
3576 | table length require \fBjust\fR 256 byte. Each character of 256 characters corresponds from the left from 0x01,0x02... to 0xff of ASCII code. Each character is set to number 0,1,2 and 3. Each number has the following meanings: |
---|
3577 | 0 ... not use for multi-byte character. |
---|
3578 | 1 ... use for first byte of multi-byte charcter. |
---|
3579 | 2 ... use for second byte of multi-byte character. |
---|
3580 | 3 ... use for both of first byte and second byte of multi-byte character. |
---|
3581 | Exapmle: |
---|
3582 | if set `001322', first character(means 0x00 of ASCII code) and second character(means 0x01 of ASCII code) is set to `0'. then, it is not use for multi-byte character.3rd character(0x02) is set '2'. it is use for first byte of multi-byte charcter. 4th character(0x03) is set '3'. it is use for both of first byte and second byte of multi-byte character. 5th and 6th character(0x04,0x05) is set '2'. it is use for second byte of multi-byte charcter. |
---|
3583 | .RE |
---|
3584 | .TP 8 |
---|
3585 | .B dunique \fR(+) |
---|
3586 | If set, \fIpushd\fR removes any instances of \fIname\fR |
---|
3587 | from the stack before pushing it onto the stack. |
---|
3588 | .TP 8 |
---|
3589 | .B echo |
---|
3590 | If set, each command with its arguments is echoed just before it is |
---|
3591 | executed. For non-builtin commands all expansions occur before |
---|
3592 | echoing. Builtin commands are echoed before command and filename |
---|
3593 | substitution, since these substitutions are then done selectively. |
---|
3594 | Set by the \fB\-x\fR command line option. |
---|
3595 | .TP 8 |
---|
3596 | .B echo_style \fR(+) |
---|
3597 | The style of the \fIecho\fR builtin. May be set to |
---|
3598 | .PP |
---|
3599 | .RS +8 |
---|
3600 | .PD 0 |
---|
3601 | .TP 8 |
---|
3602 | bsd |
---|
3603 | Don't echo a newline if the first argument is `\-n'. |
---|
3604 | .TP 8 |
---|
3605 | sysv |
---|
3606 | Recognize backslashed escape sequences in echo strings. |
---|
3607 | .TP 8 |
---|
3608 | both |
---|
3609 | Recognize both the `\-n' flag and backslashed escape sequences; the default. |
---|
3610 | .TP 8 |
---|
3611 | none |
---|
3612 | Recognize neither. |
---|
3613 | .PD |
---|
3614 | .PP |
---|
3615 | Set by default to the local system default. The BSD and System V |
---|
3616 | options are described in the \fIecho\fR(1) manpages on the appropriate |
---|
3617 | systems. |
---|
3618 | .RE |
---|
3619 | .TP 8 |
---|
3620 | .B edit \fR(+) |
---|
3621 | If set, the command-line editor is used. Set by default in interactive |
---|
3622 | shells. |
---|
3623 | .TP 8 |
---|
3624 | .B ellipsis \fR(+) |
---|
3625 | If set, the `%c'/`%.' and `%C' prompt sequences (see the \fBprompt\fR |
---|
3626 | shell variable) indicate skipped directories with an ellipsis (`...') |
---|
3627 | instead of `/<skipped>'. |
---|
3628 | .TP 8 |
---|
3629 | .B fignore \fR(+) |
---|
3630 | Lists file name suffixes to be ignored by completion. |
---|
3631 | .TP 8 |
---|
3632 | .B filec |
---|
3633 | In \fItcsh\fR, completion is always used and this variable is ignored. |
---|
3634 | If set in \fIcsh\fR, filename completion is used. |
---|
3635 | .TP 8 |
---|
3636 | .B gid \fR(+) |
---|
3637 | The user's real group ID. |
---|
3638 | .TP 8 |
---|
3639 | .B group \fR(+) |
---|
3640 | The user's group name. |
---|
3641 | .TP 8 |
---|
3642 | .B histchars |
---|
3643 | A string value determining the characters used in \fBHistory |
---|
3644 | substitution\fR (q.v.). The first character of its value is used as |
---|
3645 | the history substitution character, replacing the default character |
---|
3646 | `!'. The second character of its value replaces the character `^' in |
---|
3647 | quick substitutions. |
---|
3648 | .TP 8 |
---|
3649 | .B histdup \fR(+) |
---|
3650 | Controls handling of duplicate entries in the history list. If set to |
---|
3651 | `all' only unique history events are entered in the history list. If |
---|
3652 | set to `prev' and the last history event is the same as the current |
---|
3653 | command, then the current command is not entered in the history. If |
---|
3654 | set to `erase' and the same event is found in the history list, that |
---|
3655 | old event gets erased and the current one gets inserted. Note that the |
---|
3656 | `prev' and `all' options renumber history events so there are no gaps. |
---|
3657 | .TP 8 |
---|
3658 | .B histfile \fR(+) |
---|
3659 | The default location in which `history \-S' and `history \-L' look for |
---|
3660 | a history file. If unset, \fI~/.history\fR is used. \fBhistfile\fR is |
---|
3661 | useful when sharing the same home directory between different machines, |
---|
3662 | or when saving separate histories on different terminals. Because only |
---|
3663 | \fI~/.tcshrc\fR is normally sourced before \fI~/.history\fR, |
---|
3664 | \fBhistfile\fR should be set in \fI~/.tcshrc\fR rather than |
---|
3665 | \fI~/.login\fR. |
---|
3666 | .TP 8 |
---|
3667 | .B histlit \fR(+) |
---|
3668 | If set, builtin and editor commands and the \fBsavehist\fR mechanism |
---|
3669 | use the literal (unexpanded) form of lines in the history list. See |
---|
3670 | also the \fItoggle-literal-history\fR editor command. |
---|
3671 | .TP 8 |
---|
3672 | .B history |
---|
3673 | The first word indicates the number of history events to save. The |
---|
3674 | optional second word (+) indicates the format in which history is |
---|
3675 | printed; if not given, `%h\\t%T\\t%R\\n' is used. The format sequences |
---|
3676 | are described below under \fBprompt\fR; note the variable meaning of |
---|
3677 | `%R'. Set to `100' by default. |
---|
3678 | .TP 8 |
---|
3679 | .B home |
---|
3680 | Initialized to the home directory of the invoker. The filename |
---|
3681 | expansion of `\fI~\fR' refers to this variable. |
---|
3682 | .TP 8 |
---|
3683 | .B ignoreeof |
---|
3684 | If set to the empty string or `0' and the input device is a terminal, |
---|
3685 | the \fIend-of-file\fR command (usually generated by the user by typing |
---|
3686 | `^D' on an empty line) causes the shell to print `Use "exit" to leave |
---|
3687 | tcsh.' instead of exiting. This prevents the shell from accidentally |
---|
3688 | being killed. If set to a number \fIn\fR, the shell ignores \fIn\fR - |
---|
3689 | 1 consecutive \fIend-of-file\fRs and exits on the \fIn\fRth. (+) If |
---|
3690 | unset, `1' is used, i.e. the shell exits on a single `^D'. |
---|
3691 | .TP 8 |
---|
3692 | .B implicitcd \fR(+) |
---|
3693 | If set, the shell treats a directory name typed as a command as though |
---|
3694 | it were a request to change to that directory. If set to \fIverbose\fR, |
---|
3695 | the change of directory is echoed to the standard output. This behavior |
---|
3696 | is inhibited in non-interactive shell scripts, or for command strings |
---|
3697 | with more than one word. Changing directory takes precedence over |
---|
3698 | executing a like-named command, but it is done after alias |
---|
3699 | substitutions. Tilde and variable expansions work as expected. |
---|
3700 | .TP 8 |
---|
3701 | .B inputmode \fR(+) |
---|
3702 | If set to `insert' or `overwrite', puts the editor into that input mode |
---|
3703 | at the beginning of each line. |
---|
3704 | .TP 8 |
---|
3705 | .B listflags \fR(+) |
---|
3706 | If set to `x', `a' or `A', or any combination thereof (e.g. `xA'), they |
---|
3707 | are used as flags to \fIls\-F\fR, making it act like `ls \-xF', `ls |
---|
3708 | \-Fa', `ls \-FA' or a combination (e.g. `ls \-FxA'): `a' shows all |
---|
3709 | files (even if they start with a `.'), `A' shows all files but `.' and |
---|
3710 | `..', and `x' sorts across instead of down. If the second word of |
---|
3711 | \fBlistflags\fR is set, it is used as the path to `ls(1)'. |
---|
3712 | .TP 8 |
---|
3713 | .B listjobs \fR(+) |
---|
3714 | If set, all jobs are listed when a job is suspended. If set to `long', |
---|
3715 | the listing is in long format. |
---|
3716 | .TP 8 |
---|
3717 | .B listlinks \fR(+) |
---|
3718 | If set, the \fIls\-F\fR builtin command shows the type of file to which |
---|
3719 | each symbolic link points. |
---|
3720 | .TP 8 |
---|
3721 | .B listmax \fR(+) |
---|
3722 | The maximum number of items which the \fIlist-choices\fR editor command |
---|
3723 | will list without asking first. |
---|
3724 | .TP 8 |
---|
3725 | .B listmaxrows \fR(+) |
---|
3726 | The maximum number of rows of items which the \fIlist-choices\fR editor |
---|
3727 | command will list without asking first. |
---|
3728 | .TP 8 |
---|
3729 | .B loginsh \fR(+) |
---|
3730 | Set by the shell if it is a login shell. Setting or unsetting it |
---|
3731 | within a shell has no effect. See also \fBshlvl\fR. |
---|
3732 | .TP 8 |
---|
3733 | .B logout \fR(+) |
---|
3734 | Set by the shell to `normal' before a normal logout, `automatic' before |
---|
3735 | an automatic logout, and `hangup' if the shell was killed by a hangup |
---|
3736 | signal (see \fBSignal handling\fR). See also the \fBautologout\fR |
---|
3737 | shell variable. |
---|
3738 | .TP 8 |
---|
3739 | .B mail |
---|
3740 | The names of the files or directories to check for incoming mail, |
---|
3741 | separated by whitespace, and optionally preceeded by a numeric word. |
---|
3742 | Before each prompt, if 10 minutes have passed since the last check, the |
---|
3743 | shell checks each file and says `You have new mail.' (or, if \fBmail\fR |
---|
3744 | contains multiple files, `You have new mail in \fIname\fR.') if the |
---|
3745 | filesize is greater than zero in size and has a modification time |
---|
3746 | greater than its access time. |
---|
3747 | .PP |
---|
3748 | .RS +8 |
---|
3749 | .PD |
---|
3750 | .PP |
---|
3751 | If you are in a login shell, then no mail file is reported unless it has |
---|
3752 | been modified after the time the shell has started up, in order to prevent |
---|
3753 | redundant notifications. Most login programs will tell you whether or not |
---|
3754 | you have mail when you log in. |
---|
3755 | .PP |
---|
3756 | If a file specified in \fBmail\fR is a directory, the shell will count each |
---|
3757 | file within that directory as a separate message, and will report `You have |
---|
3758 | \fIn\fR mails.' or `You have \fIn\fR mails in \fIname\fR.' as appropriate. |
---|
3759 | This functionality is provided primarily for those systems which store mail |
---|
3760 | in this manner, such as the Andrew Mail System. |
---|
3761 | .PP |
---|
3762 | If the first word of \fBmail\fR is numeric it is taken as a different mail |
---|
3763 | checking interval, in seconds. |
---|
3764 | .PP |
---|
3765 | Under very rare circumstances, the shell may report `You have mail.' instead |
---|
3766 | of `You have new mail.' |
---|
3767 | .RE |
---|
3768 | .TP 8 |
---|
3769 | .B matchbeep \fR(+) |
---|
3770 | If set to `never', completion never beeps. |
---|
3771 | If set to `nomatch', it beeps only when there is no match. |
---|
3772 | If set to `ambiguous, it beeps when there are multiple matches. |
---|
3773 | If set to `notunique', it beeps when there is one exact and other longer matches. |
---|
3774 | If unset, `ambiguous' is used. |
---|
3775 | .TP 8 |
---|
3776 | .B nobeep \fR(+) |
---|
3777 | If set, beeping is completely disabled. |
---|
3778 | See also \fBvisiblebell\fR. |
---|
3779 | .TP 8 |
---|
3780 | .B noclobber |
---|
3781 | If set, restrictions are placed on output redirection to insure that files |
---|
3782 | are not accidentally destroyed and that `>>' redirections refer to existing |
---|
3783 | files, as described in the \fBInput/output\fR section. |
---|
3784 | .TP 8 |
---|
3785 | .B noglob |
---|
3786 | If set, \fBFilename substitution\fR and \fBDirectory stack substitution\fR |
---|
3787 | (q.v.) are inhibited. This is most useful in shell scripts which do not deal |
---|
3788 | with filenames, or after a list of filenames has been obtained and further |
---|
3789 | expansions are not desirable. |
---|
3790 | .TP 8 |
---|
3791 | .B nokanji \fR(+) |
---|
3792 | If set and the shell supports Kanji (see the \fBversion\fR shell variable), |
---|
3793 | it is disabled so that the meta key can be used. |
---|
3794 | .TP 8 |
---|
3795 | .B nonomatch |
---|
3796 | If set, a \fBFilename substitution\fR or \fBDirectory stack substitution\fR |
---|
3797 | (q.v.) which does not match any |
---|
3798 | existing files is left untouched rather than causing an error. |
---|
3799 | It is still an error for the substitution to be |
---|
3800 | malformed, e.g. `echo [' still gives an error. |
---|
3801 | .TP 8 |
---|
3802 | .B nostat \fR(+) |
---|
3803 | A list of directories (or glob-patterns which match directories; see |
---|
3804 | \fBFilename substitution\fR) that should not be \fIstat\fR(2)ed during a |
---|
3805 | completion operation. This is usually used to exclude directories which |
---|
3806 | take too much time to \fIstat\fR(2), for example \fI/afs\fR. |
---|
3807 | .TP 8 |
---|
3808 | .B notify |
---|
3809 | If set, the shell announces job completions asynchronously. |
---|
3810 | The default is to present job completions just before printing a prompt. |
---|
3811 | .TP 8 |
---|
3812 | .B oid \fR(+) |
---|
3813 | The user's real organization ID. (Domain/OS only) |
---|
3814 | .TP 8 |
---|
3815 | .B owd \fR(+) |
---|
3816 | The old working directory, equivalent to the `\-' used by \fIcd\fR and \fIpushd\fR. |
---|
3817 | See also the \fBcwd\fR and \fBdirstack\fR shell variables. |
---|
3818 | .TP 8 |
---|
3819 | .B path |
---|
3820 | A list of directories in which to look for executable commands. |
---|
3821 | A null word specifies the current directory. |
---|
3822 | If there is no \fBpath\fR variable then only full path names will execute. |
---|
3823 | \fBpath\fR is set by the shell at startup from the \fBPATH\fR environment |
---|
3824 | variable or, if \fBPATH\fR does not exist, to a system-dependent default |
---|
3825 | something like `(/usr/local/bin /usr/bsd /bin /usr/bin .)'. |
---|
3826 | The shell may put `.' first or last in \fBpath\fR or omit it entirely |
---|
3827 | depending on how it was compiled; see the \fBversion\fR shell variable. |
---|
3828 | A shell which is given neither the \fB\-c\fR nor the \fB\-t\fR option |
---|
3829 | hashes the contents of the directories in \fBpath\fR after |
---|
3830 | reading \fI~/.tcshrc\fR and each time \fBpath\fR is reset. |
---|
3831 | If one adds a new command to a directory in \fBpath\fR while the shell |
---|
3832 | is active, one may need to do a \fIrehash\fR for the shell to find it. |
---|
3833 | .TP 8 |
---|
3834 | .B printexitvalue \fR(+) |
---|
3835 | If set and an interactive program exits with a non-zero status, the shell |
---|
3836 | prints `Exit \fBstatus\fR'. |
---|
3837 | .TP 8 |
---|
3838 | .B prompt |
---|
3839 | The string which is printed before reading each command from the terminal. |
---|
3840 | \fBprompt\fR may include any of the following formatting sequences (+), which |
---|
3841 | are replaced by the given information: |
---|
3842 | .PP |
---|
3843 | .RS +8 |
---|
3844 | .PD 0 |
---|
3845 | .TP 4 |
---|
3846 | %/ |
---|
3847 | The current working directory. |
---|
3848 | .TP 4 |
---|
3849 | %~ or %d |
---|
3850 | The current working directory, but with one's home directory |
---|
3851 | represented by `~' and other users' home directories represented by |
---|
3852 | `~user' as per \fBFilename substitution\fR. `~user' substitution |
---|
3853 | happens only if the shell has already used `~\fIuser\fR' in a pathname |
---|
3854 | in the current session. |
---|
3855 | .TP 4 |
---|
3856 | %c[[0]\fIn\fR], %.[[0]\fIn\fR] |
---|
3857 | The trailing component of the current working directory, or \fIn\fR |
---|
3858 | trailing components if a digit \fIn\fR is given. |
---|
3859 | If \fIn\fR begins with `0', the number of skipped components precede |
---|
3860 | the trailing component(s) in the format `/<\fIskipped\fR>trailing'. |
---|
3861 | If the \fBellipsis\fR shell variable is set, skipped components |
---|
3862 | are represented by an ellipsis so the whole becomes `...trailing'. |
---|
3863 | `~' substitution is done as in `%~' above, but the `~' component |
---|
3864 | is ignored when counting trailing components. |
---|
3865 | .TP 4 |
---|
3866 | %C |
---|
3867 | Like %c, but without `~' substitution. |
---|
3868 | .TP 4 |
---|
3869 | %h, %!, ! |
---|
3870 | The current history event number. |
---|
3871 | .TP 4 |
---|
3872 | %M |
---|
3873 | The full hostname. |
---|
3874 | .TP 4 |
---|
3875 | %m |
---|
3876 | The hostname up to the first `.'. |
---|
3877 | .TP 4 |
---|
3878 | %S (%s) |
---|
3879 | Start (stop) standout mode. |
---|
3880 | .TP 4 |
---|
3881 | %B (%b) |
---|
3882 | Start (stop) boldfacing mode. |
---|
3883 | .TP 4 |
---|
3884 | %U (%u) |
---|
3885 | Start (stop) underline mode. |
---|
3886 | .TP 4 |
---|
3887 | %t, %@ |
---|
3888 | The time of day in 12-hour AM/PM format. |
---|
3889 | .TP 4 |
---|
3890 | %T |
---|
3891 | Like `%t', but in 24-hour format (but see the \fBampm\fR shell variable). |
---|
3892 | .TP 4 |
---|
3893 | %p |
---|
3894 | The `precise' time of day in 12-hour AM/PM format, with seconds. |
---|
3895 | .TP 4 |
---|
3896 | %P |
---|
3897 | Like `%p', but in 24-hour format (but see the \fBampm\fR shell variable). |
---|
3898 | .TP 4 |
---|
3899 | \e\fIc\fR |
---|
3900 | \fIc\fR is parsed as in \fIbindkey\fR. |
---|
3901 | .TP 4 |
---|
3902 | ^\fIc\fR |
---|
3903 | \fIc\fR is parsed as in \fIbindkey\fR. |
---|
3904 | .TP 4 |
---|
3905 | %% |
---|
3906 | A single `%'. |
---|
3907 | .TP 4 |
---|
3908 | %n |
---|
3909 | The user name. |
---|
3910 | .TP 4 |
---|
3911 | %k |
---|
3912 | The weekday in `Day' format. |
---|
3913 | .TP 4 |
---|
3914 | %D |
---|
3915 | The day in `dd' format. |
---|
3916 | .TP 4 |
---|
3917 | %w |
---|
3918 | The month in `Mon' format. |
---|
3919 | .TP 4 |
---|
3920 | %W |
---|
3921 | The month in `mm' format. |
---|
3922 | .TP 4 |
---|
3923 | %y |
---|
3924 | The year in `yy' format. |
---|
3925 | .TP 4 |
---|
3926 | %Y |
---|
3927 | The year in `yyyy' format. |
---|
3928 | .TP 4 |
---|
3929 | %l |
---|
3930 | The shell's tty. |
---|
3931 | .TP 4 |
---|
3932 | %L |
---|
3933 | Clears from the end of the prompt to end of the display or the end of the line. |
---|
3934 | .TP 4 |
---|
3935 | %$ |
---|
3936 | Expands the shell or environment variable name immediately after the `$'. |
---|
3937 | .TP 4 |
---|
3938 | %# |
---|
3939 | `>' (or the first character of the \fBpromptchars\fR shell variable) |
---|
3940 | for normal users, `#' (or the second character of \fBpromptchars\fR) |
---|
3941 | for the superuser. |
---|
3942 | .TP 4 |
---|
3943 | %{\fIstring\fR%} |
---|
3944 | Includes \fIstring\fR as a literal escape sequence. |
---|
3945 | It should be used only to change terminal attributes and |
---|
3946 | should not move the cursor location. This |
---|
3947 | cannot be the last sequence in \fBprompt\fR. |
---|
3948 | .TP 4 |
---|
3949 | %? |
---|
3950 | The return code of the command executed just before the prompt. |
---|
3951 | .TP 4 |
---|
3952 | %R |
---|
3953 | In \fBprompt2\fR, the status of the parser. |
---|
3954 | In \fBprompt3\fR, the corrected string. |
---|
3955 | In \fBhistory\fR, the history string. |
---|
3956 | .PD |
---|
3957 | .PP |
---|
3958 | `%B', `%S', `%U' and `%{\fIstring\fR%}' are available only in |
---|
3959 | eight-bit-clean shells; see the \fBversion\fR shell variable. |
---|
3960 | .PP |
---|
3961 | The bold, standout and underline sequences are often used to distinguish a |
---|
3962 | superuser shell. For example, |
---|
3963 | .IP "" 4 |
---|
3964 | > set prompt = "%m [%h] %B[%@]%b [%/] you rang? " |
---|
3965 | .br |
---|
3966 | tut [37] \fB[2:54pm]\fR [/usr/accts/sys] you rang? _ |
---|
3967 | .PP |
---|
3968 | Set by default to `%# ' in interactive shells. |
---|
3969 | .RE |
---|
3970 | .TP 8 |
---|
3971 | .B prompt2 \fR(+) |
---|
3972 | The string with which to prompt in \fIwhile\fR and \fIforeach\fR loops and |
---|
3973 | after lines ending in `\\'. |
---|
3974 | The same format sequences may be used as in \fBprompt\fR (q.v.); |
---|
3975 | note the variable meaning of `%R'. |
---|
3976 | Set by default to `%R? ' in interactive shells. |
---|
3977 | .TP 8 |
---|
3978 | .B prompt3 \fR(+) |
---|
3979 | The string with which to prompt when confirming automatic spelling correction. |
---|
3980 | The same format sequences may be used as in \fBprompt\fR (q.v.); |
---|
3981 | note the variable meaning of `%R'. |
---|
3982 | Set by default to `CORRECT>%R (y|n|e|a)? ' in interactive shells. |
---|
3983 | .TP 8 |
---|
3984 | .B promptchars \fR(+) |
---|
3985 | If set (to a two-character string), the `%#' formatting sequence in the |
---|
3986 | \fBprompt\fR shell variable is replaced with the first character for |
---|
3987 | normal users and the second character for the superuser. |
---|
3988 | .TP 8 |
---|
3989 | .B pushdtohome \fR(+) |
---|
3990 | If set, \fIpushd\fR without arguments does `pushd ~', like \fIcd\fR. |
---|
3991 | .TP 8 |
---|
3992 | .B pushdsilent \fR(+) |
---|
3993 | If set, \fIpushd\fR and \fIpopd\fR do not print the directory stack. |
---|
3994 | .TP 8 |
---|
3995 | .B recexact \fR(+) |
---|
3996 | If set, completion completes on an exact match even if a longer match is |
---|
3997 | possible. |
---|
3998 | .TP 8 |
---|
3999 | .B recognize_only_executables \fR(+) |
---|
4000 | If set, command listing displays only files in the path that are |
---|
4001 | executable. Slow. |
---|
4002 | .TP 8 |
---|
4003 | .B rmstar \fR(+) |
---|
4004 | If set, the user is prompted before `rm *' is executed. |
---|
4005 | .TP 8 |
---|
4006 | .B rprompt \fR(+) |
---|
4007 | The string to print on the right-hand side of the screen (after |
---|
4008 | the command input) when the prompt is being displayed on the left. |
---|
4009 | It recognises the same formatting characters as \fBprompt\fR. |
---|
4010 | It will automatically disappear and reappear as necessary, to ensure that |
---|
4011 | command input isn't obscured, and will only appear if the prompt, |
---|
4012 | command input, and itself will fit together on the first line. |
---|
4013 | If \fBedit\fR isn't set, then \fBrprompt\fR will be printed after |
---|
4014 | the prompt and before the command input. |
---|
4015 | .TP 8 |
---|
4016 | .B savedirs \fR(+) |
---|
4017 | If set, the shell does `dirs \-S' before exiting. |
---|
4018 | .TP 8 |
---|
4019 | .B savehist |
---|
4020 | If set, the shell does `history \-S' before exiting. |
---|
4021 | If the first word is set to a number, at most that many lines are saved. |
---|
4022 | (The number must be less than or equal to \fBhistory\fR.) |
---|
4023 | If the second word is set to `merge', the history list is merged with |
---|
4024 | the existing history file instead of replacing it (if there is one) and |
---|
4025 | sorted by time stamp and the most recent events are retained. (+) |
---|
4026 | .TP 8 |
---|
4027 | .B sched \fR(+) |
---|
4028 | The format in which the \fIsched\fR builtin command prints scheduled events; |
---|
4029 | if not given, `%h\\t%T\\t%R\\n' is used. |
---|
4030 | The format sequences are described above under \fBprompt\fR; |
---|
4031 | note the variable meaning of `%R'. |
---|
4032 | .TP 8 |
---|
4033 | .B shell |
---|
4034 | The file in which the shell resides. This is used in forking |
---|
4035 | shells to interpret files which have execute bits set, but |
---|
4036 | which are not executable by the system. (See the description |
---|
4037 | of \fBBuiltin and non-builtin command execution\fR.) Initialized to the |
---|
4038 | (system-dependent) home of the shell. |
---|
4039 | .TP 8 |
---|
4040 | .B shlvl \fR(+) |
---|
4041 | The number of nested shells. |
---|
4042 | Reset to 1 in login shells. |
---|
4043 | See also \fBloginsh\fR. |
---|
4044 | .TP 8 |
---|
4045 | .B status |
---|
4046 | The status returned by the last command. If it terminated |
---|
4047 | abnormally, then 0200 is added to the status. Builtin commands |
---|
4048 | which fail return exit status `1', all other builtin commands |
---|
4049 | return status `0'. |
---|
4050 | .TP 8 |
---|
4051 | .B symlinks \fR(+) |
---|
4052 | Can be set to several different values to control symbolic link (`symlink') |
---|
4053 | resolution: |
---|
4054 | .RS +8 |
---|
4055 | .PP |
---|
4056 | If set to `chase', whenever the current directory changes to a directory |
---|
4057 | containing a symbolic link, it is expanded to the real name of the directory |
---|
4058 | to which the link points. This does not work for the user's home directory; |
---|
4059 | this is a bug. |
---|
4060 | .PP |
---|
4061 | If set to `ignore', the shell tries to construct a current directory |
---|
4062 | relative to the current directory before the link was crossed. |
---|
4063 | This means that \fIcd\fRing through a symbolic link and then `cd ..'ing |
---|
4064 | returns one to the original directory. This only affects builtin commands |
---|
4065 | and filename completion. |
---|
4066 | .PP |
---|
4067 | If set to `expand', the shell tries to fix symbolic links by actually expanding |
---|
4068 | arguments which look like path names. This affects any command, not just |
---|
4069 | builtins. Unfortunately, this does not work for hard-to-recognize filenames, |
---|
4070 | such as those embedded in command options. Expansion may be prevented by |
---|
4071 | quoting. While this setting is usually the most convenient, it is sometimes |
---|
4072 | misleading and sometimes confusing when it fails to recognize an argument |
---|
4073 | which should be expanded. A compromise is to use `ignore' and use the |
---|
4074 | editor command \fInormalize-path\fR (bound by default to ^X-n) when necessary. |
---|
4075 | .PP |
---|
4076 | Some examples are in order. First, let's set up some play directories: |
---|
4077 | .IP "" 4 |
---|
4078 | > cd /tmp |
---|
4079 | .br |
---|
4080 | > mkdir from from/src to |
---|
4081 | .br |
---|
4082 | > ln \-s from/src to/dist |
---|
4083 | .PP |
---|
4084 | Here's the behavior with \fBsymlinks\fR unset, |
---|
4085 | .IP "" 4 |
---|
4086 | > cd /tmp/to/dist; echo $cwd |
---|
4087 | .br |
---|
4088 | /tmp/to/dist |
---|
4089 | .br |
---|
4090 | > cd ..; echo $cwd |
---|
4091 | .br |
---|
4092 | /tmp/from |
---|
4093 | .PP |
---|
4094 | here's the behavior with \fBsymlinks\fR set to `chase', |
---|
4095 | .IP "" 4 |
---|
4096 | > cd /tmp/to/dst; echo $cwd |
---|
4097 | .br |
---|
4098 | /tmp/from/src |
---|
4099 | .br |
---|
4100 | > cd ..; echo $cwd |
---|
4101 | .br |
---|
4102 | /tmp/from |
---|
4103 | .PP |
---|
4104 | here's the behavior with \fBsymlinks\fR set to `ignore', |
---|
4105 | .IP "" 4 |
---|
4106 | > cd /tmp/to/dist; echo $cwd |
---|
4107 | .br |
---|
4108 | /tmp/to/dst |
---|
4109 | .br |
---|
4110 | > cd ..; echo $cwd |
---|
4111 | .br |
---|
4112 | /tmp/to |
---|
4113 | .PP |
---|
4114 | and here's the behavior with \fBsymlinks\fR set to `expand'. |
---|
4115 | .IP "" 4 |
---|
4116 | > cd /tmp/to/dist; echo $cwd |
---|
4117 | .br |
---|
4118 | /tmp/to/dst |
---|
4119 | .br |
---|
4120 | > cd ..; echo $cwd |
---|
4121 | .br |
---|
4122 | /tmp/to |
---|
4123 | .br |
---|
4124 | > cd /tmp/to/dist; echo $cwd |
---|
4125 | .br |
---|
4126 | /tmp/to/dst |
---|
4127 | .br |
---|
4128 | > cd ".."; echo $cwd |
---|
4129 | .br |
---|
4130 | /tmp/from |
---|
4131 | .br |
---|
4132 | > /bin/echo .. |
---|
4133 | .br |
---|
4134 | /tmp/to |
---|
4135 | .br |
---|
4136 | > /bin/echo ".." |
---|
4137 | .br |
---|
4138 | \&.. |
---|
4139 | .PP |
---|
4140 | Note that `expand' expansion 1) works just like `ignore' for builtins |
---|
4141 | like \fIcd\fR, 2) is prevented by quoting, and 3) happens before |
---|
4142 | filenames are passed to non-builtin commands. |
---|
4143 | .RE |
---|
4144 | .TP 8 |
---|
4145 | .B tcsh \fR(+) |
---|
4146 | The version number of the shell in the format `R.VV.PP', |
---|
4147 | where `R' is the major release number, `VV' the current version |
---|
4148 | and `PP' the patchlevel. |
---|
4149 | .TP 8 |
---|
4150 | .B term |
---|
4151 | The terminal type. Usually set in \fI~/.login\fR as described under |
---|
4152 | \fBStartup and shutdown\fR. |
---|
4153 | .TP 8 |
---|
4154 | .B time |
---|
4155 | If set to a number, then the \fItime\fR builtin (q.v.) executes automatically |
---|
4156 | after each command which takes more than that many CPU seconds. |
---|
4157 | If there is a second word, it is used as a format string for the output |
---|
4158 | of the \fItime\fR builtin. (u) The following sequences may be used in the |
---|
4159 | format string: |
---|
4160 | .PP |
---|
4161 | .RS +8 |
---|
4162 | .PD 0 |
---|
4163 | .TP 4 |
---|
4164 | %U |
---|
4165 | The time the process spent in user mode in cpu seconds. |
---|
4166 | .TP 4 |
---|
4167 | %S |
---|
4168 | The time the process spent in kernel mode in cpu seconds. |
---|
4169 | .TP 4 |
---|
4170 | %E |
---|
4171 | The elapsed (wall clock) time in seconds. |
---|
4172 | .TP 4 |
---|
4173 | %P |
---|
4174 | The CPU percentage computed as (%U + %S) / %E. |
---|
4175 | .TP 4 |
---|
4176 | %W |
---|
4177 | Number of times the process was swapped. |
---|
4178 | .TP 4 |
---|
4179 | %X |
---|
4180 | The average amount in (shared) text space used in Kbytes. |
---|
4181 | .TP 4 |
---|
4182 | %D |
---|
4183 | The average amount in (unshared) data/stack space used in Kbytes. |
---|
4184 | .TP 4 |
---|
4185 | %K |
---|
4186 | The total space used (%X + %D) in Kbytes. |
---|
4187 | .TP 4 |
---|
4188 | %M |
---|
4189 | The maximum memory the process had in use at any time in Kbytes. |
---|
4190 | .TP 4 |
---|
4191 | %F |
---|
4192 | The number of major page faults (page needed to be brought from disk). |
---|
4193 | .TP 4 |
---|
4194 | %R |
---|
4195 | The number of minor page faults. |
---|
4196 | .TP 4 |
---|
4197 | %I |
---|
4198 | The number of input operations. |
---|
4199 | .TP 4 |
---|
4200 | %O |
---|
4201 | The number of output operations. |
---|
4202 | .TP 4 |
---|
4203 | %r |
---|
4204 | The number of socket messages received. |
---|
4205 | .TP 4 |
---|
4206 | %s |
---|
4207 | The number of socket messages sent. |
---|
4208 | .TP 4 |
---|
4209 | %k |
---|
4210 | The number of signals received. |
---|
4211 | .TP 4 |
---|
4212 | %w |
---|
4213 | The number of voluntary context switches (waits). |
---|
4214 | .TP 4 |
---|
4215 | %c |
---|
4216 | The number of involuntary context switches. |
---|
4217 | .PD |
---|
4218 | .PP |
---|
4219 | Only the first four sequences are supported on systems without BSD resource |
---|
4220 | limit functions. |
---|
4221 | The default time format is `%Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww' for |
---|
4222 | systems that support resource usage reporting and `%Uu %Ss %E %P' for |
---|
4223 | systems that do not. |
---|
4224 | .PP |
---|
4225 | Under Sequent's DYNIX/ptx, %X, %D, %K, %r and %s are not |
---|
4226 | available, but the following additional sequences are: |
---|
4227 | .PP |
---|
4228 | .PD 0 |
---|
4229 | .TP 4 |
---|
4230 | %Y |
---|
4231 | The number of system calls performed. |
---|
4232 | .TP 4 |
---|
4233 | %Z |
---|
4234 | The number of pages which are zero-filled on demand. |
---|
4235 | .TP 4 |
---|
4236 | %i |
---|
4237 | The number of times a process's resident set size was increased by the kernel. |
---|
4238 | .TP 4 |
---|
4239 | %d |
---|
4240 | The number of times a process's resident set size was decreased by the kernel. |
---|
4241 | .TP 4 |
---|
4242 | %l |
---|
4243 | The number of read system calls performed. |
---|
4244 | .TP 4 |
---|
4245 | %m |
---|
4246 | The number of write system calls performed. |
---|
4247 | .TP 4 |
---|
4248 | %p |
---|
4249 | The number of reads from raw disk devices. |
---|
4250 | .TP 4 |
---|
4251 | %q |
---|
4252 | The number of writes to raw disk devices. |
---|
4253 | .PD |
---|
4254 | .PP |
---|
4255 | and the default time format is `%Uu %Ss $E %P %I+%Oio %Fpf+%Ww'. |
---|
4256 | Note that the CPU percentage can be higher than 100% on multi-processors. |
---|
4257 | .RE |
---|
4258 | .TP 8 |
---|
4259 | .B tperiod \fR(+) |
---|
4260 | The period, in minutes, between executions of the \fIperiodic\fR special alias. |
---|
4261 | .TP 8 |
---|
4262 | .B tty \fR(+) |
---|
4263 | The name of the tty, or empty if not attached to one. |
---|
4264 | .TP 8 |
---|
4265 | .B uid \fR(+) |
---|
4266 | The user's real user ID. |
---|
4267 | .TP 8 |
---|
4268 | .B user |
---|
4269 | The user's login name. |
---|
4270 | .TP 8 |
---|
4271 | .B verbose |
---|
4272 | If set, causes the words of each |
---|
4273 | command to be printed, after history substitution (if any). |
---|
4274 | Set by the \fB\-v\fR command line option. |
---|
4275 | .TP 8 |
---|
4276 | .B version \fR(+) |
---|
4277 | The version ID stamp. It contains the shell's version number (see \fBtcsh\fR), |
---|
4278 | origin, release date, vendor, operating system and machine (see \fBVENDOR\fR, |
---|
4279 | \fBOSTYPE\fR and \fBMACHTYPE\fR) and a comma-separated |
---|
4280 | list of options which were set at compile time. |
---|
4281 | Options which are set by default in the distribution are noted. |
---|
4282 | .PP |
---|
4283 | .RS +8 |
---|
4284 | .PD 0 |
---|
4285 | .TP 4 |
---|
4286 | 8b |
---|
4287 | The shell is eight bit clean; default |
---|
4288 | .TP 4 |
---|
4289 | 7b |
---|
4290 | The shell is not eight bit clean |
---|
4291 | .TP 4 |
---|
4292 | nls |
---|
4293 | The system's NLS is used; default for systems with NLS |
---|
4294 | .TP 4 |
---|
4295 | lf |
---|
4296 | Login shells execute \fI/etc/csh.login\fR before instead of after |
---|
4297 | \fI/etc/csh.cshrc\fR and \fI~/.login\fR before instead of after |
---|
4298 | \fI~/.tcshrc\fR and \fI~/.history\fR. |
---|
4299 | .TP 4 |
---|
4300 | dl |
---|
4301 | `.' is put last in \fBpath\fR for security; default |
---|
4302 | .TP 4 |
---|
4303 | nd |
---|
4304 | `.' is omitted from \fBpath\fR for security |
---|
4305 | .TP 4 |
---|
4306 | vi |
---|
4307 | \fIvi\fR-style editing is the default rather than \fIemacs\fR |
---|
4308 | .TP 4 |
---|
4309 | dtr |
---|
4310 | Login shells drop DTR when exiting |
---|
4311 | .TP 4 |
---|
4312 | bye |
---|
4313 | \fIbye\fR is a synonym for \fIlogout\fR and \fIlog\fR |
---|
4314 | is an alternate name for \fIwatchlog\fR |
---|
4315 | .TP 4 |
---|
4316 | al |
---|
4317 | \fBautologout\fR is enabled; default |
---|
4318 | .TP 4 |
---|
4319 | kan |
---|
4320 | Kanji is used and the ISO character set is ignored, |
---|
4321 | unless the \fBnokanji\fR shell variable is set |
---|
4322 | .TP 4 |
---|
4323 | sm |
---|
4324 | The system's \fImalloc\fR(3) is used |
---|
4325 | .TP 4 |
---|
4326 | hb |
---|
4327 | The `#!<program> <args>' convention is emulated when executing shell scripts |
---|
4328 | .TP 4 |
---|
4329 | ng |
---|
4330 | The \fInewgrp\fR builtin is available |
---|
4331 | .TP 4 |
---|
4332 | rh |
---|
4333 | The shell attempts to set the \fBREMOTEHOST\fR environment variable |
---|
4334 | .TP 4 |
---|
4335 | afs |
---|
4336 | The shell verifies your password with the kerberos server if local |
---|
4337 | authentication fails. The \fBafsuser\fR shell variable or the |
---|
4338 | \fBAFSUSER\fR environment variable override your local username if set. |
---|
4339 | .PD |
---|
4340 | .PP |
---|
4341 | An administrator may enter additional strings to indicate differences |
---|
4342 | in the local version. |
---|
4343 | .RE |
---|
4344 | .TP 8 |
---|
4345 | .B visiblebell \fR(+) |
---|
4346 | If set, a screen flash is used rather than the audible bell. |
---|
4347 | See also \fBnobeep\fR. |
---|
4348 | .TP 8 |
---|
4349 | .B watch \fR(+) |
---|
4350 | A list of user/terminal pairs to watch for logins and logouts. |
---|
4351 | If either the user is `any' all terminals are watched for the given user |
---|
4352 | and vice versa. |
---|
4353 | Setting \fBwatch\fR to `(any any)' watches all users and terminals. |
---|
4354 | For example, |
---|
4355 | .RS +8 |
---|
4356 | .IP "" 4 |
---|
4357 | set watch = (george ttyd1 any console $user any) |
---|
4358 | .PP |
---|
4359 | reports activity of the user `george' on ttyd1, any user on the console, and |
---|
4360 | oneself (or a trespasser) on any terminal. |
---|
4361 | .PP |
---|
4362 | Logins and logouts are checked every 10 minutes by default, but the first |
---|
4363 | word of \fBwatch\fR can be set to a number to check every so many minutes. |
---|
4364 | For example, |
---|
4365 | .IP "" 4 |
---|
4366 | set watch = (1 any any) |
---|
4367 | .PP |
---|
4368 | reports any login/logout once every minute. For the impatient, the \fIlog\fR |
---|
4369 | builtin command triggers a \fBwatch\fR report at any time. All current logins |
---|
4370 | are reported (as with the \fIlog\fR builtin) when \fBwatch\fR is first set. |
---|
4371 | .PP |
---|
4372 | The \fBwho\fR shell variable controls the format of \fBwatch\fR reports. |
---|
4373 | .RE |
---|
4374 | .TP 8 |
---|
4375 | .B who \fR(+) |
---|
4376 | The format string for \fBwatch\fR messages. The following sequences |
---|
4377 | are replaced by the given information: |
---|
4378 | .PP |
---|
4379 | .RS +8 |
---|
4380 | .PD 0 |
---|
4381 | .TP 4 |
---|
4382 | %n |
---|
4383 | The name of the user who logged in/out. |
---|
4384 | .TP 4 |
---|
4385 | %a |
---|
4386 | The observed action, i.e. `logged on', `logged off' or `replaced \fIolduser\fR on'. |
---|
4387 | .TP 4 |
---|
4388 | %l |
---|
4389 | The terminal (tty) on which the user logged in/out. |
---|
4390 | .TP 4 |
---|
4391 | %M |
---|
4392 | The full hostname of the remote host, or `local' if the login/logout was |
---|
4393 | from the local host. |
---|
4394 | .TP 4 |
---|
4395 | %m |
---|
4396 | The hostname of the remote host up to the first `.'. |
---|
4397 | The full name is printed if it is an IP address or an X Window System display. |
---|
4398 | .PD |
---|
4399 | .PP |
---|
4400 | %M and %m are available only on systems which store the remote hostname in |
---|
4401 | \fI/etc/utmp\fR. |
---|
4402 | If unset, `%n has %a %l from %m.' is used, or `%n has %a %l.' on systems |
---|
4403 | which don't store the remote hostname. |
---|
4404 | .RE |
---|
4405 | .TP 8 |
---|
4406 | .B wordchars \fR(+) |
---|
4407 | A list of non-alphanumeric characters to be considered part of a word by the |
---|
4408 | \fIforward-word\fR, \fIbackward-word\fR etc. editor commands. |
---|
4409 | If unset, `*?_\-.[]~=' is used. |
---|
4410 | .SH ENVIRONMENT |
---|
4411 | .TP 8 |
---|
4412 | .B AFSUSER \fR(+) |
---|
4413 | Equivalent to the \fBafsuser\fR shell variable. |
---|
4414 | .TP 8 |
---|
4415 | .B COLUMNS |
---|
4416 | The number of columns in the terminal. See \fBTerminal management\fR. |
---|
4417 | .TP 8 |
---|
4418 | .B DISPLAY |
---|
4419 | Used by X Window System (see \fIX\fR(1)). |
---|
4420 | If set, the shell does not set \fBautologout\fR (q.v.). |
---|
4421 | .TP 8 |
---|
4422 | .B EDITOR |
---|
4423 | The pathname to a default editor. |
---|
4424 | See also the \fBVISUAL\fR environment variable |
---|
4425 | and the \fIrun-fg-editor\fR editor command. |
---|
4426 | .TP 8 |
---|
4427 | .B GROUP \fR(+) |
---|
4428 | Equivalent to the \fBgroup\fR shell variable. |
---|
4429 | .TP 8 |
---|
4430 | .B HOME |
---|
4431 | Equivalent to the \fBhome\fR shell variable. |
---|
4432 | .TP 8 |
---|
4433 | .B HOST \fR(+) |
---|
4434 | Initialized to the name of the machine on which the shell |
---|
4435 | is running, as determined by the \fIgethostname\fR(2) system call. |
---|
4436 | .TP 8 |
---|
4437 | .B HOSTTYPE \fR(+) |
---|
4438 | Initialized to the type of machine on which the shell |
---|
4439 | is running, as determined at compile time. This variable is obsolete and |
---|
4440 | will be removed in a future version. |
---|
4441 | .TP 8 |
---|
4442 | .B HPATH \fR(+) |
---|
4443 | A colon-separated list of directories in which the \fIrun-help\fR editor |
---|
4444 | command looks for command documentation. |
---|
4445 | .TP 8 |
---|
4446 | .B LANG |
---|
4447 | Gives the preferred character environment. |
---|
4448 | See \fBNative Language System support\fR. |
---|
4449 | .TP 8 |
---|
4450 | .B LC_CTYPE |
---|
4451 | If set, only ctype character handling is changed. |
---|
4452 | See \fBNative Language System support\fR. |
---|
4453 | .TP 8 |
---|
4454 | .B LINES |
---|
4455 | The number of lines in the terminal. See \fBTerminal management\fR. |
---|
4456 | .TP 8 |
---|
4457 | .B LS_COLORS |
---|
4458 | The format of this variable is reminicent of the \fBtermcap(5)\fR |
---|
4459 | file format; a colon-separated list of expressions of the form |
---|
4460 | "\fIxx=string\fR", where "\fIxx\fR" is a two-character variable name. The |
---|
4461 | variables with their associated defaults are: |
---|
4462 | .PP |
---|
4463 | .RS +8 |
---|
4464 | .nf |
---|
4465 | no 0 Normal (non-filename) text |
---|
4466 | fi 0 Regular file |
---|
4467 | di 01;34 Directory |
---|
4468 | ln 01;36 Symbolic link |
---|
4469 | pi 33 Named pipe (FIFO) |
---|
4470 | so 01;35 Socket |
---|
4471 | bd 01;33 Block device |
---|
4472 | cd 01;32 Character device |
---|
4473 | ex 01;32 Executable file |
---|
4474 | mi (none) Missing file (defaults to fi) |
---|
4475 | or (none) Orphanned symbolic link (defaults to ln) |
---|
4476 | lc ^[[ Left code |
---|
4477 | rc m Right code |
---|
4478 | ec (none) End code (replaces lc+no+rc) |
---|
4479 | .fi |
---|
4480 | .PP |
---|
4481 | You only need to include the variables you want to change from |
---|
4482 | the default. |
---|
4483 | .PP |
---|
4484 | File names can also be colorized based on filename extension. |
---|
4485 | This is specified in the \fBLS_COLORS\fR variable using the syntax |
---|
4486 | \fB"*ext=string"\fR. For example, using ISO 6429 codes, to color |
---|
4487 | all C\-language source files blue you would specify \fB"*.c=34"\fR. |
---|
4488 | This would color all files ending in \fB.c\fR in blue (34) color. |
---|
4489 | .PP |
---|
4490 | Control characters can be written either in C\-style\-escaped |
---|
4491 | notation, or in stty\-like ^\-notation. The C\-style notation |
---|
4492 | adds \fB^[\fR for Escape, \fB\_\fR for a normal space characer, |
---|
4493 | and \fB?\fR for Delete. In addition, the \fB^[\fR escape character |
---|
4494 | can be used to override the default interpretation of \fB^[\fR, |
---|
4495 | \fB^\fR, \fB:\fR and \fB=\fR. |
---|
4496 | .PP |
---|
4497 | Each file will be written as \fB<lc>\fR \fB<color-code>\fR |
---|
4498 | \fB<rc>\fR \fB<filename>\fR \fB<ec>\fR. If the \fB<ec>\fR |
---|
4499 | code is undefined, the sequence \fB<lc>\fR \fB<no> |
---|
4500 | \fB<rc>\fR will be used instead. This is generally more convenient |
---|
4501 | to use, but less general. The left, right and end codes are |
---|
4502 | provided so you don't have to type common parts over and over |
---|
4503 | again and to support weird terminals; you will generally not |
---|
4504 | need to change them at all unless your terminal does not use |
---|
4505 | ISO 6429 color sequences but a different system. |
---|
4506 | .PP |
---|
4507 | If your terminal does use ISO 6429 color codes, you can |
---|
4508 | compose the type codes (i.e. all except the \fBlc\fR, \fBrc\fR, |
---|
4509 | and \fBec\fR codes) from numerical commands separated by semicolons. The |
---|
4510 | most common commands are: |
---|
4511 | .PP |
---|
4512 | .RS +8 |
---|
4513 | .PD 0 |
---|
4514 | .TP 4 |
---|
4515 | 0 |
---|
4516 | to restore default color |
---|
4517 | .TP 4 |
---|
4518 | 1 |
---|
4519 | for brighter colors |
---|
4520 | .TP 4 |
---|
4521 | 4 |
---|
4522 | for underlined text |
---|
4523 | .TP 4 |
---|
4524 | 5 |
---|
4525 | for flashing text |
---|
4526 | .TP 4 |
---|
4527 | 30 |
---|
4528 | for black foreground |
---|
4529 | .TP 4 |
---|
4530 | 31 |
---|
4531 | for red foreground |
---|
4532 | .TP 4 |
---|
4533 | 32 |
---|
4534 | for green foreground |
---|
4535 | .TP 4 |
---|
4536 | 33 |
---|
4537 | for yellow (or brown) foreground |
---|
4538 | .TP 4 |
---|
4539 | 34 |
---|
4540 | for blue foreground |
---|
4541 | .TP 4 |
---|
4542 | 35 |
---|
4543 | for purple foreground |
---|
4544 | .TP 4 |
---|
4545 | 36 |
---|
4546 | for cyan foreground |
---|
4547 | .TP 4 |
---|
4548 | 37 |
---|
4549 | for white (or gray) foreground |
---|
4550 | .TP 4 |
---|
4551 | 40 |
---|
4552 | for black background |
---|
4553 | .TP 4 |
---|
4554 | 41 |
---|
4555 | for red background |
---|
4556 | .TP 4 |
---|
4557 | 42 |
---|
4558 | for green background |
---|
4559 | .TP 4 |
---|
4560 | 43 |
---|
4561 | for yellow (or brown) background |
---|
4562 | .TP 4 |
---|
4563 | 44 |
---|
4564 | for blue background |
---|
4565 | .TP 4 |
---|
4566 | 45 |
---|
4567 | for purple background |
---|
4568 | .TP 4 |
---|
4569 | 46 |
---|
4570 | for cyan background |
---|
4571 | .TP 4 |
---|
4572 | 47 |
---|
4573 | for white (or gray) background |
---|
4574 | .RE |
---|
4575 | .PP |
---|
4576 | Not all commands will work on all systems or display devices. |
---|
4577 | .PP |
---|
4578 | A few terminal programs do not recognize the default end code |
---|
4579 | properly. If all text gets colorized after you do a directory |
---|
4580 | listing, try changing the \fBno\fR and \fBfi\fR codes from 0 to the |
---|
4581 | numerical codes for your standard fore- and background colors. |
---|
4582 | .RE |
---|
4583 | .TP 8 |
---|
4584 | .B MACHTYPE \fR(+) |
---|
4585 | The machine type (microprocessor class or machine model), as determined at compile time. |
---|
4586 | .TP 8 |
---|
4587 | .B NOREBIND \fR(+) |
---|
4588 | If set, printable characters are not rebound to \fIself-insert-command\fR. |
---|
4589 | See \fBNative Language System support\fR. |
---|
4590 | .TP 8 |
---|
4591 | .B OSTYPE \fR(+) |
---|
4592 | The operating system, as determined at compile time. |
---|
4593 | .TP 8 |
---|
4594 | .B PATH |
---|
4595 | A colon-separated list of directories in which to look for executables. |
---|
4596 | Equivalent to the \fBpath\fR shell variable, but in a different format. |
---|
4597 | .TP 8 |
---|
4598 | .B PWD \fR(+) |
---|
4599 | Equivalent to the \fBcwd\fR shell variable, but not synchronized to it; |
---|
4600 | updated only after an actual directory change. |
---|
4601 | .TP 8 |
---|
4602 | .B REMOTEHOST \fR(+) |
---|
4603 | The host from which the user has logged in remotely, if this is the case and |
---|
4604 | the shell is able to determine it. Set only if the shell was so compiled; |
---|
4605 | see the \fBversion\fR shell variable. |
---|
4606 | .TP 8 |
---|
4607 | .B SHLVL \fR(+) |
---|
4608 | Equivalent to the \fBshlvl\fR shell variable. |
---|
4609 | .TP 8 |
---|
4610 | .B SYSTYPE \fR(+) |
---|
4611 | The current system type. (Domain/OS only) |
---|
4612 | .TP 8 |
---|
4613 | .B TERM |
---|
4614 | Equivalent to the \fBterm\fR shell variable. |
---|
4615 | .TP 8 |
---|
4616 | .B TERMCAP |
---|
4617 | The terminal capability string. See \fBTerminal management\fR. |
---|
4618 | .TP 8 |
---|
4619 | .B USER |
---|
4620 | Equivalent to the \fBuser\fR shell variable. |
---|
4621 | .TP 8 |
---|
4622 | .B VENDOR \fR(+) |
---|
4623 | The vendor, as determined at compile time. |
---|
4624 | .TP 8 |
---|
4625 | .B VISUAL |
---|
4626 | The pathname to a default full-screen editor. |
---|
4627 | See also the \fBEDITOR\fR environment variable |
---|
4628 | and the \fIrun-fg-editor\fR editor command. |
---|
4629 | .SH FILES |
---|
4630 | .PD 0 |
---|
4631 | .TP 16 |
---|
4632 | .I /etc/csh.cshrc |
---|
4633 | Read first by every shell. |
---|
4634 | ConvexOS, Stellix and Intel use \fI/etc/cshrc\fR and |
---|
4635 | NeXTs use \fI/etc/cshrc.std\fR. |
---|
4636 | A/UX, AMIX, Cray and IRIX have no equivalent in \fIcsh\fR(1), |
---|
4637 | but read this file in \fItcsh\fR anyway. |
---|
4638 | Solaris 2.x does not have it either, but \fItcsh\fR reads \fI/etc/.cshrc\fR. (+) |
---|
4639 | .TP 16 |
---|
4640 | .I /etc/csh.login |
---|
4641 | Read by login shells after \fI/etc/csh.cshrc\fR. |
---|
4642 | ConvexOS, Stellix and Intel use \fI/etc/login\fR, |
---|
4643 | NeXTs use \fI/etc/login.std\fR, Solaris 2.x uses \fI/etc/.login\fR and |
---|
4644 | A/UX, AMIX, Cray and IRIX use \fI/etc/cshrc\fR. |
---|
4645 | .TP 16 |
---|
4646 | .I ~/.tcshrc \fR(+) |
---|
4647 | Read by every shell after \fI/etc/csh.cshrc\fR or its equivalent. |
---|
4648 | .TP 16 |
---|
4649 | .I ~/.cshrc |
---|
4650 | Read by every shell, if \fI~/.tcshrc\fR doesn't exist, |
---|
4651 | after \fI/etc/csh.cshrc\fR or its equivalent. |
---|
4652 | This manual uses `\fI~/.tcshrc\fR' to mean `\fI~/.tcshrc\fR or, |
---|
4653 | if \fI~/.tcshrc\fR is not found, \fI~/.cshrc\fR'. |
---|
4654 | .TP 16 |
---|
4655 | .I ~/.history |
---|
4656 | Read by login shells after \fI~/.tcshrc\fR |
---|
4657 | if \fBsavehist\fR is set, but see also \fBhistfile\fR. |
---|
4658 | .TP 16 |
---|
4659 | .I ~/.login |
---|
4660 | Read by login shells after \fI~/.tcshrc\fR or \fI~/.history\fR. |
---|
4661 | The shell may be compiled to read \fI~/.login\fR before instead of after |
---|
4662 | \fI~/.tcshrc\fR and \fI~/.history\fR; see the \fBversion\fR shell variable. |
---|
4663 | .TP 16 |
---|
4664 | .I ~/.cshdirs \fR(+) |
---|
4665 | Read by login shells after \fI~/.login\fR |
---|
4666 | if \fBsavedirs\fR is set, but see also \fBdirsfile\fR. |
---|
4667 | .TP 16 |
---|
4668 | .I /etc/csh.logout |
---|
4669 | Read by login shells at logout. |
---|
4670 | ConvexOS, Stellix and Intel use \fI/etc/logout\fR and |
---|
4671 | NeXTs use \fI/etc/logout.std\fR. |
---|
4672 | A/UX, AMIX, Cray and IRIX have no equivalent in \fIcsh\fR(1), |
---|
4673 | but read this file in \fItcsh\fR anyway. |
---|
4674 | Solaris 2.x does not have it either, but \fItcsh\fR reads \fI/etc/.cshrc\fR. (+) |
---|
4675 | .TP 16 |
---|
4676 | .I ~/.logout |
---|
4677 | Read by login shells at logout after \fI/etc/csh.logout\fR or its equivalent. |
---|
4678 | .TP 16 |
---|
4679 | .I /bin/sh |
---|
4680 | Used to interpret shell scripts not starting with a `#'. |
---|
4681 | .TP 16 |
---|
4682 | .I /tmp/sh* |
---|
4683 | Temporary file for `<<'. |
---|
4684 | .TP 16 |
---|
4685 | .I /etc/passwd |
---|
4686 | Source of home directories for `~name' substitutions. |
---|
4687 | .PD |
---|
4688 | .PP |
---|
4689 | The order in which startup files are read may differ if the shell was so |
---|
4690 | compiled; see \fBStartup and shutdown\fR and the \fBversion\fR shell variable. |
---|
4691 | .SH "NEW FEATURES (+)" |
---|
4692 | This manual describes \fItcsh\fR as a single entity, |
---|
4693 | but experienced \fIcsh\fR(1) users will want to pay special attention to |
---|
4694 | \fItcsh\fR's new features. |
---|
4695 | .PP |
---|
4696 | A command-line editor, which supports GNU Emacs or \fIvi\fR(1)-style |
---|
4697 | key bindings. See \fBThe command-line editor\fR and \fBEditor commands\fR. |
---|
4698 | .PP |
---|
4699 | Programmable, interactive word completion and listing. |
---|
4700 | See \fBCompletion and listing\fR and the \fIcomplete\fR and \fIuncomplete\fR |
---|
4701 | builtin commands. |
---|
4702 | .PP |
---|
4703 | \fBSpelling correction\fR (q.v.) of filenames, commands and variables. |
---|
4704 | .PP |
---|
4705 | \fBEditor commands\fR (q.v.) which perform other useful functions in the middle of |
---|
4706 | typed commands, including documentation lookup (\fIrun-help\fR), |
---|
4707 | quick editor restarting (\fIrun-fg-editor\fR) and |
---|
4708 | command resolution (\fIwhich-command\fR). |
---|
4709 | .PP |
---|
4710 | An enhanced history mechanism. Events in the history list are time-stamped. |
---|
4711 | See also the \fIhistory\fR command and its associated shell variables, |
---|
4712 | the previously undocumented `#' event specifier and new modifiers |
---|
4713 | under \fBHistory substitution\fR, |
---|
4714 | the \fI*-history\fR, \fIhistory-search-*\fR, \fIi-search-*\fR, \fIvi-search-*\fR and |
---|
4715 | \fItoggle-literal-history\fR editor commands |
---|
4716 | and the \fBhistlit\fR shell variable. |
---|
4717 | .PP |
---|
4718 | Enhanced directory parsing and directory stack handling. |
---|
4719 | See the \fIcd\fR, \fIpushd\fR, \fIpopd\fR and \fIdirs\fR commands and their associated |
---|
4720 | shell variables, the description of \fBDirectory stack substitution\fR, |
---|
4721 | the \fBdirstack\fR, \fBowd\fR and \fBsymlinks\fR shell variables and |
---|
4722 | the \fInormalize-command\fR and \fInormalize-path\fR editor commands. |
---|
4723 | .PP |
---|
4724 | Negation in glob-patterns. See \fBFilename substitution\fR. |
---|
4725 | .PP |
---|
4726 | New \fBFile inquiry operators\fR (q.v.) and a \fIfiletest\fR |
---|
4727 | builtin which uses them. |
---|
4728 | .PP |
---|
4729 | A variety of \fBAutomatic, periodic and timed events\fR (q.v.) including |
---|
4730 | scheduled events, special aliases, automatic logout and terminal locking, |
---|
4731 | command timing and watching for logins and logouts. |
---|
4732 | .PP |
---|
4733 | Support for the Native Language System |
---|
4734 | (see \fBNative Language System support\fR), |
---|
4735 | OS variant features |
---|
4736 | (see \fBOS variant support\fR and the \fBecho_style\fR shell variable) |
---|
4737 | and system-dependent file locations (see \fBFILES\fR). |
---|
4738 | .PP |
---|
4739 | Extensive terminal-managment capabilities. See \fBTerminal management\fR. |
---|
4740 | .PP |
---|
4741 | New builtin commands including \fIbuiltins\fR, \fIhup\fR, \fIls\-F\fR, |
---|
4742 | \fInewgrp\fR, \fIprintenv\fR, \fIwhich\fR and \fIwhere\fR (q.v.). |
---|
4743 | .PP |
---|
4744 | New variables that make useful information easily available to the shell. |
---|
4745 | See the \fBgid\fR, \fBloginsh\fR, \fBoid\fR, \fBshlvl\fR, \fBtcsh\fR, |
---|
4746 | \fBtty\fR, \fBuid\fR and \fBversion\fR shell variables and the \fBHOST\fR, |
---|
4747 | \fBREMOTEHOST\fR, \fBVENDOR\fR, \fBOSTYPE\fR and \fBMACHTYPE\fR environment |
---|
4748 | variables. |
---|
4749 | .PP |
---|
4750 | A new syntax for including useful information in the prompt string |
---|
4751 | (see \fBprompt\fR). |
---|
4752 | and special prompts for loops and spelling correction |
---|
4753 | (see \fBprompt2\fR and \fBprompt3\fR). |
---|
4754 | .PP |
---|
4755 | Read-only variables. See \fBVariable substitution\fR. |
---|
4756 | .SH BUGS |
---|
4757 | When a suspended command is restarted, the shell prints the directory |
---|
4758 | it started in if this is different from the current directory. This can |
---|
4759 | be misleading (i.e. wrong) as the job may have changed directories internally. |
---|
4760 | .PP |
---|
4761 | Shell builtin functions are not stoppable/restartable. Command sequences |
---|
4762 | of the form `a ; b ; c' are also not handled gracefully when stopping is |
---|
4763 | attempted. If you suspend `b', the shell will then immediately execute |
---|
4764 | `c'. This is especially noticeable if this expansion results from an |
---|
4765 | \fIalias\fR. It suffices to place the sequence of commands in ()'s to force it |
---|
4766 | to a subshell, i.e. `( a ; b ; c )'. |
---|
4767 | .PP |
---|
4768 | Control over tty output after processes are started is primitive; perhaps |
---|
4769 | this will inspire someone to work on a good virtual terminal interface. |
---|
4770 | In a virtual terminal interface much more interesting things could be |
---|
4771 | done with output control. |
---|
4772 | .PP |
---|
4773 | Alias substitution is most often used to clumsily simulate shell procedures; |
---|
4774 | shell procedures should be provided rather than aliases. |
---|
4775 | .PP |
---|
4776 | Commands within loops are not placed in the history |
---|
4777 | list. Control structures should be parsed rather than being recognized as |
---|
4778 | built-in commands. This would allow control commands to be placed anywhere, |
---|
4779 | to be combined with `|', and to be used with `&' and `;' metasyntax. |
---|
4780 | .PP |
---|
4781 | \fIforeach\fR doesn't ignore here documents when looking for its \fIend\fR. |
---|
4782 | .PP |
---|
4783 | It should be possible to use the `:' modifiers on the output of command |
---|
4784 | substitutions. |
---|
4785 | .PP |
---|
4786 | The screen update for lines longer than the screen width is very poor |
---|
4787 | if the terminal cannot move the cursor up (i.e. terminal type `dumb'). |
---|
4788 | .PP |
---|
4789 | \fBHPATH\fR and \fBNOREBIND\fR don't need to be environment variables. |
---|
4790 | .PP |
---|
4791 | Glob-patterns which do not use `?', `*' or `[]' or which use `{}' or `~' |
---|
4792 | are not negated correctly. |
---|
4793 | .PP |
---|
4794 | The single-command form of \fIif\fR does output redirection even if |
---|
4795 | the expression is false and the command is not executed. |
---|
4796 | .PP |
---|
4797 | \fIls\-F\fR includes file identification characters when sorting filenames |
---|
4798 | and does not handle control characters in filenames well. It cannot be |
---|
4799 | interrupted. |
---|
4800 | .PP |
---|
4801 | Report bugs to tcsh-bugs@mx.gw.com, preferably with fixes. If you want to |
---|
4802 | help maintain and test tcsh, send mail to listserv@mx.gw.com with the text |
---|
4803 | `subscribe tcsh <your name>' on a line by itself in the body. You can |
---|
4804 | also `subscribe tcsh-bugs <your name>' to get all bug reports, or |
---|
4805 | `subscribe tcsh-diffs <your name>' to get the development list plus |
---|
4806 | diffs for each patchlevel. |
---|
4807 | .SH THE T IN TCSH |
---|
4808 | In 1964, DEC produced the PDP-6. The PDP-10 was a later re-implementation. It |
---|
4809 | was re-christened the DECsystem-10 in 1970 or so when DEC brought out the |
---|
4810 | second model, the KI10. |
---|
4811 | .PP |
---|
4812 | TENEX was created at Bolt, Beranek & Newman (a Cambridge, Mass. think tank) in |
---|
4813 | 1972 as an experiment in demand-paged virtual memory operating systems. They |
---|
4814 | built a new pager for the DEC PDP-10 and created the OS to go with it. It was |
---|
4815 | extremely successful in academia. |
---|
4816 | .PP |
---|
4817 | In 1975, DEC brought out a new model of the PDP-10, the KL10; they intended to |
---|
4818 | have only a version of TENEX, which they had licensed from BBN, for the new |
---|
4819 | box. They called their version TOPS-20 (their capitalization is trademarked). |
---|
4820 | A lot of TOPS-10 users (`The OPerating System for PDP-10') objected; thus DEC |
---|
4821 | found themselves supporting two incompatible systems on the same hardware--but |
---|
4822 | then there were 6 on the PDP-11! |
---|
4823 | .PP |
---|
4824 | TENEX, and TOPS-20 to version 3, had command completion |
---|
4825 | via a user-code-level subroutine library called ULTCMD. With version 3, DEC |
---|
4826 | moved all that capability and more into the monitor (`kernel' for you Unix |
---|
4827 | types), accessed by the COMND% JSYS (`Jump to SYStem' instruction, the |
---|
4828 | supervisor call mechanism [are my IBM roots also showing?]). |
---|
4829 | .PP |
---|
4830 | The creator of tcsh was impressed by this feature and several others of TENEX |
---|
4831 | and TOPS-20, and created a version of csh which mimicked them. |
---|
4832 | .SH LIMITATIONS |
---|
4833 | Words can be no longer than 1024 characters. |
---|
4834 | .PP |
---|
4835 | The system limits argument lists to 10240 characters. |
---|
4836 | .PP |
---|
4837 | The number of arguments to a command which involves filename expansion is |
---|
4838 | limited to 1/6th the number of characters allowed in an argument list. |
---|
4839 | .PP |
---|
4840 | Command substitutions may substitute no more characters than are allowed in |
---|
4841 | an argument list. |
---|
4842 | .PP |
---|
4843 | To detect looping, the shell restricts the number of \fIalias\fR |
---|
4844 | substitutions on a single line to 20. |
---|
4845 | .SH "SEE ALSO" |
---|
4846 | csh(1), emacs(1), ls(1), newgrp(1), sh(1), setpath(1), stty(1), su(1), |
---|
4847 | tset(1), vi(1), x(1), access(2), execve(2), fork(2), killpg(2), |
---|
4848 | pipe(2), setrlimit(2), sigvec(2), stat(2), umask(2), vfork(2), wait(2), |
---|
4849 | malloc(3), setlocale(3), tty(4), a.out(5), termcap(5), environ(7), |
---|
4850 | termio(7), Introduction to the C Shell |
---|
4851 | .SH VERSION |
---|
4852 | This manual documents tcsh 6.08.00 (Astron) 1998-10-02. |
---|
4853 | .SH AUTHORS |
---|
4854 | .PD 0 |
---|
4855 | .TP 2 |
---|
4856 | William Joy |
---|
4857 | Original author of \fIcsh\fR(1) |
---|
4858 | .TP 2 |
---|
4859 | J.E. Kulp, IIASA, Laxenburg, Austria |
---|
4860 | Job control and directory stack features |
---|
4861 | .TP 2 |
---|
4862 | Ken Greer, HP Labs, 1981 |
---|
4863 | File name completion |
---|
4864 | .TP 2 |
---|
4865 | Mike Ellis, Fairchild, 1983 |
---|
4866 | Command name recognition/completion |
---|
4867 | .TP 2 |
---|
4868 | Paul Placeway, Ohio State CIS Dept., 1983-1993 |
---|
4869 | Command line editor, prompt routines, new glob syntax and numerous fixes |
---|
4870 | and speedups |
---|
4871 | .TP 2 |
---|
4872 | Karl Kleinpaste, CCI 1983-4 |
---|
4873 | Special aliases, directory stack extraction stuff, login/logout watch, |
---|
4874 | scheduled events, and the idea of the new prompt format |
---|
4875 | .TP 2 |
---|
4876 | Rayan Zachariassen, University of Toronto, 1984 |
---|
4877 | \fIls\-F\fR and \fIwhich\fR builtins and numerous bug fixes, modifications |
---|
4878 | and speedups |
---|
4879 | .TP 2 |
---|
4880 | Chris Kingsley, Caltech |
---|
4881 | Fast storage allocator routines |
---|
4882 | .TP 2 |
---|
4883 | Chris Grevstad, TRW, 1987 |
---|
4884 | Incorporated 4.3BSD \fIcsh\fR into \fItcsh\fR |
---|
4885 | .TP 2 |
---|
4886 | Christos S. Zoulas, Cornell U. EE Dept., 1987-94 |
---|
4887 | Ports to HPUX, SVR2 and SVR3, a SysV version of getwd.c, SHORT_STRINGS support |
---|
4888 | and a new version of sh.glob.c |
---|
4889 | .TP 2 |
---|
4890 | James J Dempsey, BBN, and Paul Placeway, OSU, 1988 |
---|
4891 | A/UX port |
---|
4892 | .TP 2 |
---|
4893 | Daniel Long, NNSC, 1988 |
---|
4894 | \fBwordchars\fR |
---|
4895 | .TP 2 |
---|
4896 | Patrick Wolfe, Kuck and Associates, Inc., 1988 |
---|
4897 | \fIvi\fR mode cleanup |
---|
4898 | .TP 2 |
---|
4899 | David C Lawrence, Rensselaer Polytechnic Institute, 1989 |
---|
4900 | \fBautolist\fR and ambiguous completion listing |
---|
4901 | .TP 2 |
---|
4902 | Alec Wolman, DEC, 1989 |
---|
4903 | Newlines in the prompt |
---|
4904 | .TP 2 |
---|
4905 | Matt Landau, BBN, 1989 |
---|
4906 | \fI~/.tcshrc\fR |
---|
4907 | .TP 2 |
---|
4908 | Ray Moody, Purdue Physics, 1989 |
---|
4909 | Magic spacebar history expansion |
---|
4910 | .TP 2 |
---|
4911 | Mordechai ????, Intel, 1989 |
---|
4912 | printprompt() fixes and additions |
---|
4913 | .TP 2 |
---|
4914 | Kazuhiro Honda, Dept. of Computer Science, Keio University, 1989 |
---|
4915 | Automatic spelling correction and \fBprompt3\fR |
---|
4916 | .TP 2 |
---|
4917 | Per Hedeland, Ellemtel, Sweden, 1990- |
---|
4918 | Various bugfixes, improvements and manual updates |
---|
4919 | .TP 2 |
---|
4920 | Hans J. Albertsson (Sun Sweden) |
---|
4921 | \fBampm\fR, \fIsettc\fR and \fItelltc\fR |
---|
4922 | .TP 2 |
---|
4923 | Michael Bloom |
---|
4924 | Interrupt handling fixes |
---|
4925 | .TP 2 |
---|
4926 | Michael Fine, Digital Equipment Corp |
---|
4927 | Extended key support |
---|
4928 | .TP 2 |
---|
4929 | Eric Schnoebelen, Convex, 1990 |
---|
4930 | Convex support, lots of \fIcsh\fR bug fixes, |
---|
4931 | save and restore of directory stack |
---|
4932 | .TP 2 |
---|
4933 | Ron Flax, Apple, 1990 |
---|
4934 | A/UX 2.0 (re)port |
---|
4935 | .TP 2 |
---|
4936 | Dan Oscarsson, LTH Sweden, 1990 |
---|
4937 | NLS support and simulated NLS support for non NLS sites, fixes |
---|
4938 | .TP 2 |
---|
4939 | Johan Widen, SICS Sweden, 1990 |
---|
4940 | \fBshlvl\fR, Mach support, \fIcorrect-line\fR, 8-bit printing |
---|
4941 | .TP 2 |
---|
4942 | Matt Day, Sanyo Icon, 1990 |
---|
4943 | POSIX termio support, SysV limit fixes |
---|
4944 | .TP 2 |
---|
4945 | Jaap Vermeulen, Sequent, 1990-91 |
---|
4946 | Vi mode fixes, expand-line, window change fixes, Symmetry port |
---|
4947 | .TP 2 |
---|
4948 | Martin Boyer, Institut de recherche d'Hydro-Quebec, 1991 |
---|
4949 | \fBautolist\fR beeping options, modified the history search to search for |
---|
4950 | the whole string from the beginning of the line to the cursor. |
---|
4951 | .TP 2 |
---|
4952 | Scott Krotz, Motorola, 1991 |
---|
4953 | Minix port |
---|
4954 | .TP 2 |
---|
4955 | David Dawes, Sydney U. Australia, Physics Dept., 1991 |
---|
4956 | SVR4 job control fixes |
---|
4957 | .TP 2 |
---|
4958 | Jose Sousa, Interactive Systems Corp., 1991 |
---|
4959 | Extended \fIvi\fR fixes and \fIvi\fR delete command |
---|
4960 | .TP 2 |
---|
4961 | Marc Horowitz, MIT, 1991 |
---|
4962 | ANSIfication fixes, new exec hashing code, imake fixes, \fIwhere\fR |
---|
4963 | .TP 2 |
---|
4964 | Bruce Sterling Woodcock, sterling@netcom.com, 1991-1995 |
---|
4965 | ETA and Pyramid port, Makefile and lint fixes, \fBignoreeof\fR=n addition, and |
---|
4966 | various other portability changes and bug fixes |
---|
4967 | .TP 2 |
---|
4968 | Jeff Fink, 1992 |
---|
4969 | \fIcomplete-word-fwd\fR and \fIcomplete-word-back\fR |
---|
4970 | .TP 2 |
---|
4971 | Harry C. Pulley, 1992 |
---|
4972 | Coherent port |
---|
4973 | .TP 2 |
---|
4974 | Andy Phillips, Mullard Space Science Lab U.K., 1992 |
---|
4975 | VMS-POSIX port |
---|
4976 | .TP 2 |
---|
4977 | Beto Appleton, IBM Corp., 1992 |
---|
4978 | Walking process group fixes, \fIcsh\fR bug fixes, |
---|
4979 | POSIX file tests, POSIX SIGHUP |
---|
4980 | .TP 2 |
---|
4981 | Scott Bolte, Cray Computer Corp., 1992 |
---|
4982 | CSOS port |
---|
4983 | .TP 2 |
---|
4984 | Kaveh R. Ghazi, Rutgers University, 1992 |
---|
4985 | Tek, m88k, Titan and Masscomp ports and fixes. Added autoconf support. |
---|
4986 | .TP 2 |
---|
4987 | Mark Linderman, Cornell University, 1992 |
---|
4988 | OS/2 port |
---|
4989 | .TP 2 |
---|
4990 | Mika Liljeberg, liljeber@kruuna.Helsinki.FI, 1992 |
---|
4991 | Linux port |
---|
4992 | .TP 2 |
---|
4993 | Tim P. Starrin, NASA Langley Research Center Operations, 1993 |
---|
4994 | Read-only variables |
---|
4995 | .TP 2 |
---|
4996 | Dave Schweisguth, Yale University, 1993-4 |
---|
4997 | New manpage and tcsh.man2html |
---|
4998 | .TP 2 |
---|
4999 | Larry Schwimmer, Stanford University, 1993 |
---|
5000 | AFS and HESIOD patches |
---|
5001 | .TP 2 |
---|
5002 | Luke Mewburn, RMIT University, 1994-6 |
---|
5003 | Enhanced directory printing in prompt, |
---|
5004 | added \fBellipsis\fR and \fBrprompt\fR. |
---|
5005 | .TP 2 |
---|
5006 | Edward Hutchins, Silicon Graphics Inc., 1996 |
---|
5007 | Added implicit cd. |
---|
5008 | .TP 2 |
---|
5009 | Martin Kraemer, 1997 |
---|
5010 | Ported to Siemens Nixdorf EBCDIC machine |
---|
5011 | .TP 2 |
---|
5012 | Amol Deshpande, Microsoft, 1997 |
---|
5013 | Ported to WIN32 (Windows/95 and Windows/NT); wrote all the missing library |
---|
5014 | and message catalog code to interface to Windows. |
---|
5015 | .TP 2 |
---|
5016 | Taga Nayuta, 1998 |
---|
5017 | Color ls additions. |
---|
5018 | .PD |
---|
5019 | .PP |
---|
5020 | .SH "THANKS TO" |
---|
5021 | Bryan Dunlap, Clayton Elwell, Karl Kleinpaste, Bob Manson, Steve Romig, |
---|
5022 | Diana Smetters, Bob Sutterfield, Mark Verber, Elizabeth Zwicky and all |
---|
5023 | the other people at Ohio State for suggestions and encouragement |
---|
5024 | .PP |
---|
5025 | All the people on the net, for putting up with, |
---|
5026 | reporting bugs in, and suggesting new additions to each and every version |
---|
5027 | .PP |
---|
5028 | Richard M. Alderson III, for writing the `T in tcsh' section |
---|