]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/tcsh/tcsh.man.new
sysctl(9): Fix a few mandoc related issues
[FreeBSD/FreeBSD.git] / contrib / tcsh / tcsh.man.new
1 .\"
2 .\" Copyright (c) 1980, 1990, 1993
3 .\"     The Regents of the University of California.  All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\" 3. Neither the name of the University nor the names of its contributors
14 .\"    may be used to endorse or promote products derived from this software
15 .\"    without specific prior written permission.
16 .\"
17 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS `AS IS' AND
18 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 .\" OR SERVICES; LESS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 .\" SUCH DAMAGE.
28 .\"
29 .\" - Indent in multiples of 4, usually 8.
30 .\"
31 .\" - Use \` for literal back-quote (`).
32 .\"
33 .\" - Use \e for literal backslash (\).
34 .\"
35 .\" - Use \-, not -.
36 .\"
37 .\" - Include the tilde when naming dot files. .Pa ~/.login , not .Pa .login
38 .\"
39 .\" - Refer to external commands in man page format, e.g., .Xr csh 1
40 .\" However, tcsh is .Nm , because this is the tcsh man page (and
41 .\" see the next note anyway).
42 .\"
43 .\" - Say .Sq the shell , not .Sq tcsh ,
44 .\" unless distinguishing between tcsh and csh.
45 .\"
46 .\" - Say .Sq shell variable / .Sq environment variable instead of
47 .\" .Sq variable and .Sq builtin command / .Sq editor command instead of
48 .\" .Sq builtin or .Sq command
49 .\"   unless the distinction is absolutely clear from context.
50 .\"
51 .\" - Use the simple present tense.
52 .\" .Sq The shell uses , not .Sq The shell will use
53 .\"
54 .\" - IMPORTANT: Cross-reference as much as possible. Commands, variables,
55 .\"   etc. in the reference section should be mentioned in the appropriate
56 .\"   descriptive section, or at least in the reference-section description
57 .\"   of another command (or whatever) which is mentioned in a description
58 .\"   section. Remember to note OS-specific things in "OS variant support",
59 .\"   new features in NEW FEATURES and referenced external commands in SEE
60 .\"   ALSO.
61 .\"
62 .\" - tcsh.man2html depends heavily on the specific nroff commands used in the
63 .\"   man page when the script was written. Please stick closely to the style
64 .\"   used here if you can. In particular, please don't use nroff commands
65 .\"   which aren't already used herein.
66 .\"
67 .Dd May 8, 2019
68 .Dt TCSH 1
69 .Os Astron 6.21.00
70 .Sh NAME
71 .Nm tcsh
72 .Nd C shell with file name completion and command line editing
73 .Sh SYNOPSIS
74 .Nm
75 .Op Fl bcdefFimnqstvVxX
76 .Op Fl Dname Ns Op =value
77 .Op Ar arg ...
78 .Nm
79 .Fl l
80 .Ek
81 .Sh DESCRIPTION
82 .Nm
83 is an enhanced but completely compatible version of the Berkeley
84 UNIX C shell,
85 .Xr csh 1 .
86 It is a command language interpreter usable both as an interactive login
87 shell and a shell script command processor.
88 It includes a command-line editor (see
89 .Sx The command-line editor )
90 programmable word completion (see
91 .Sx Completion and listing )
92 spelling correction (see
93 .Sx Spelling correction ) ,
94 a history mechanism (see
95 .Sx History substitution ) ,
96 job control (see
97 .Sx Jobs )
98 and a C-like syntax.
99 The
100 .Sx NEW FEATURES
101 section describes major enhancements of
102 .Nm
103 over
104 .Xr csh 1 .
105 Throughout this manual, features of
106 .Nm
107 not found in most
108 .Xr csh 1
109 implementations
110 (specifically, the 4.4BSD one)
111 are labeled with
112 .Sq (+) ,
113 and features which are present in
114 .Xr csh 1
115 but not usually documented are labeled with
116 .Sq (u) .
117 .Bl -tag
118 .Ss Argument list processing
119 If the first argument (argument 0) to the shell is
120 .Sq \-
121 then it is a login shell.
122 A login shell can be also specified by invoking the shell with
123 the
124 .Fl l
125 flag as the only argument.
126 .Pp
127 The rest of the flag arguments are interpreted as follows:
128 .Bl -tag -width indent
129 .It Fl b
130 Forces a
131 .Dq break
132 from option processing, causing any
133 further shell arguments to be treated as non-option arguments.
134 The remaining arguments will not be interpreted as shell options.
135 This may be used to pass options to a shell script without confusion
136 or possible subterfuge.
137 The shell will not run a set-user ID script without this option.
138 .It Fl c
139 Commands are read from the following argument (which must be present, and
140 must be a single argument),
141 stored in the
142 .Va command
143 shell variable for reference, and executed.
144 Any remaining arguments are placed in the
145 .Va argv
146 shell variable.
147 .It Fl d
148 The shell loads the directory stack from
149 .Pa ~/.cshdirs
150 as described under
151 .Sx Startup and shutdown ,
152 whether or not it is a login shell. (+)
153 .It Fl Dname Ns Op =value
154 Sets the environment variable
155 .Va name
156 .Dv value .
157 (Domain/OS only) (+)
158 .It Fl e
159 The shell exits if any invoked command terminates abnormally or
160 yields a non-zero exit status.
161 .It Fl f
162 The shell does not load any resource or startup files, or perform any
163 command hashing, and thus starts faster.
164 .It Fl F
165 The shell uses
166 .Xr fork 2
167 instead of
168 .Xr vfork 2
169 to spawn processes. (+)
170 .It Fl i
171 The shell is interactive and prompts for its top-level input, even if
172 it appears to not be a terminal.
173 Shells are interactive without this option if
174 their inputs and outputs are terminals.
175 .It Fl l
176 The shell is a login shell.
177 Applicable only if
178 .Fl l
179 is the only
180 flag specified.
181 .It Fl m
182 The shell loads
183 .Pa ~/.tcshrc
184 even if it does not belong to the effective user.
185 Newer versions of
186 .Xr su 1
187 can pass
188 .Fl m
189 to the shell. (+)
190 .It Fl n
191 The shell parses commands but does not execute them.
192 This aids in debugging shell scripts.
193 .It Fl q
194 The shell accepts SIGQUIT (see
195 .Sx Signal handling )
196 and behaves when it is used under a debugger.
197 Job control is disabled. (u)
198 .It Fl s
199 Command input is taken from the standard input.
200 .It Fl t
201 The shell reads and executes a single line of input.
202 A
203 .Sq \e
204 may be used to
205 escape the newline at the end of this line and continue onto another line.
206 .It Fl v
207 Sets the
208 .Va verbose
209 shell variable, so that
210 command input is echoed after history substitution.
211 .It Fl x
212 Sets the
213 .Va echo
214 shell variable, so that commands are echoed
215 immediately before execution.
216 .It Fl V
217 Sets the
218 .Va verbose
219 shell variable even before executing
220 .Pa ~/.tcshrc .
221 .It Fl X
222 Is to
223 .Fl x
224 as
225 .Fl V
226 is to
227 .Fl v .
228 .TP 4
229 .It Fl \-help
230 Print a help message on the standard output and exit. (+)
231 .It Fl \-version
232 Print the version/platform/compilation options on the standard output and exit.
233 This information is also contained in the
234 .Va version
235 shell variable. (+)
236 .El
237 .Pp
238 After processing of flag arguments, if arguments remain but none of the
239 .Fl c ,
240 .Fl i ,
241 .Fl s ,
242 or
243 .Fl t
244 options were given, the first argument is taken as the name of a file of
245 commands, or
246 .Dq script ,
247 to be executed.
248 The shell opens this file and saves its name for possible
249 resubstitution by
250 .Sq $0 .
251 Because many systems use either the standard
252 version 6 or version 7 shells whose shell scripts are not compatible
253 with this shell, the shell uses such a
254 .Sq standard
255 shell to execute a script
256 whose first character is not a
257 .Sq # ,
258 i.e., that does not start with a
259 comment.
260 .Pp
261 Remaining arguments are placed in the
262 .Va argv
263 shell variable.
264 .Ss Startup and shutdown
265 A login shell begins by executing commands from the system files
266 .Pa /etc/csh.cshrc
267 and
268 .Pa /etc/csh.login .
269 It then executes commands from files in the user's
270 .Pa home
271 directory:
272 first
273 .Pa ~/.tcshrc (+)
274 or, if
275 .Pa ~/.tcshrc
276 is not found,
277 .Pa ~/.cshrc ,
278 then
279 .Pa ~/.history
280 (or the value of the
281 .Va histfile
282 shell variable), then
283 .Pa ~/.login ,
284 and finally
285 .Pa ~/.cshdirs
286 (or the value of the
287 .Va dirsfile
288 shell variable) (+).
289 The shell may read
290 .Pa /etc/csh.login
291 before instead of after
292 .Pa /etc/csh.cshrc ,
293 and
294 .Pa ~/.login
295 before instead of after
296 .Pa ~/.tcshrc
297 or
298 .Pa ~/.cshrc
299 and
300 .Pa ~/.history ,
301 if so compiled;
302 see the
303 .Va version
304 shell variable. (+)
305 .Pp
306 Non-login shells read only
307 .Pa /etc/csh.cshrc
308 and
309 .Pa ~/.tcshrc
310 or
311 .Pa ~/.cshrc
312 on startup.
313 .Pp
314 For examples of startup files, please consult:
315 .Lk http://tcshrc.sourceforge.net
316 .Pp
317 Commands like
318 .Xr stty 1
319 and
320 .Xr tset 1 ,
321 which need be run only once per login, usually go in one's
322 .Pa ~/.login
323 file.
324 Users who need to use the same set of files with both
325 .Xr csh 1
326 and
327 .Nm
328 can have only a
329 .Pa ~/.cshrc
330 which checks for the existence of the
331 .Va tcsh
332 shell variable (q.v.) before using
333 .Nm \-
334 specific commands,
335 or can have both a
336 .Pa ~/.cshrc
337 and a
338 .Pa ~/.tcshrc
339 which
340 .Ic sources
341 (see the builtin command)
342 .Pa ~/.cshrc .
343 The rest of this manual uses
344 .Pa ~/.tcshrc
345 to mean
346 .Pa ~/.tcshrc
347 or,
348 if
349 .Pa ~/.tcshrc
350 is not found,
351 .Pa ~/.cshrc .
352 .Pp
353 In the normal case, the shell begins reading commands from the terminal,
354 prompting with
355 .Sq >\~ .
356 (Processing of arguments and the use of the shell to
357 process files containing command scripts are described later.)
358 The shell repeatedly reads a line of command input, breaks it into words,
359 places it on the command history list, parses it and executes each command
360 in the line.
361 .Pp
362 One can log out by typing
363 .Sq ^D
364 on an empty line,
365 .Sq logout
366 or
367 .Sq login
368 or
369 via the shell's autologout mechanism (see the
370 .Va autologout
371 shell variable).
372 When a login shell terminates it sets the
373 .Va logout
374 shell variable to
375 .Sq normal
376 or
377 .Sq automatic
378 as appropriate, then executes commands from the files
379 .Pa /etc/csh.logout
380 and
381 .Pa ~/.logout .
382 The shell may drop DTR on logout
383 if so compiled; see the
384 .Va version
385 shell variable.
386 .Pp
387 The names of the system login and logout files vary from system to system for
388 compatibility with different
389 .Xr csh 1
390 variants; see
391 .Sx FILES .
392 .Ss Editing
393 We first describe
394 .Sx The command-line editor
395 The
396 .Sx Completion and listing
397 and
398 .Sx Spelling correction
399 sections describe two sets of functionality that are implemented as editor
400 commands but which deserve their own treatment.
401 Finally,
402 .Sx Editor commands
403 lists and describes
404 the editor commands specific to the shell and their default bindings.
405 .Ss The command-line editor (+)
406 Command-line input can be edited using key sequences much like those used in
407 .Xr emacs 1
408 or
409 .Xr vi 1 .
410 The editor is active only when the
411 .Va edit
412 shell variable is set, which it is by default in interactive shells.
413 The
414 .Ic bindkey
415 builtin can display and change key bindings.
416 .Xr emacs 1
417 style key bindings are used by default
418 (unless the shell was compiled otherwise; see the
419 .Va version
420 shell variable),
421 but
422 .Ic bindkey
423 can change the key bindings to
424 .Xr vi 1
425 style bindings en masse.
426 .Pp
427 The shell always binds the arrow keys (as defined in the
428 .Va TERMCAP
429 environment variable) to:
430 .Pp
431 .Bl -tag -width right -compact -offset indent
432 .It down
433 .Ic down-history
434 .It up
435 .Ic up-history
436 .It left
437 .Ic backward-char
438 .It right
439 .Ic forward-char
440 .El
441 .Pp
442 unless doing so would alter another single-character binding.
443 One can set the arrow key escape sequences to the empty string with
444 .Va settc
445 to prevent these bindings.
446 The ANSI/VT100 sequences for arrow keys are always bound.
447 .Pp
448 Other key bindings are, for the most part, what
449 .Xr emacs 1
450 and
451 .Xr vi 1
452 users would expect and can easily be displayed by
453 .Ic bindkey ,
454 so there
455 is no need to list them here.
456 Likewise,
457 .Ic bindkey
458 can list the editor
459 commands with a short description of each.
460 Certain key bindings have different behavior depending if
461 .Xr emacs 1
462 or
463 .Xr vi 1
464 style bindings are being used; see
465 .Va vimode
466 for more information.
467 .Pp
468 Note that editor commands do not have the same notion of a
469 .Dq word
470 as does the shell.
471 The editor delimits words with any non-alphanumeric characters not in
472 the shell variable
473 .Va wordchars ,
474 while the shell recognizes only whitespace
475 and some of the characters with special meanings to it, listed under
476 .Sx Lexical structure .
477 .Ss Completion and listing (+)
478 The shell is often able to complete words when given a unique abbreviation.
479 Type part of a word (for example
480 .Ic ls
481 .Pa /usr/lost )
482 and hit the tab key to run the
483 .Ic complete-word
484 editor command.
485 The shell completes the filename
486 .Pa /usr/lost
487 to
488 .Pa /usr/lost+found/ ,
489 replacing the incomplete word with the complete word in the input buffer.
490 (Note the terminal
491 .Sq / ;
492 completion adds a
493 .Sq /
494 to the end of completed directories and a space to the end of other completed
495 words, to speed typing and provide a visual indicator of successful completion.
496 The
497 .Va addsuffix
498 shell variable can be unset to prevent this.)
499 If no match is found (perhaps
500 .Pa /usr/lost+found
501 doesn't exist), the terminal bell rings.
502 If the word is already complete (perhaps there is a
503 .Pa /usr/lost
504 on your
505 system, or perhaps you were thinking too far ahead and typed the whole thing)
506 a
507 .Sq /
508 or space is added to the end if it isn't already there.
509 .Pp
510 Completion works anywhere in the line, not at just the end; completed
511 text pushes the rest of the line to the right.
512 Completion in the middle of a word
513 often results in leftover characters to the right of the cursor that need
514 to be deleted.
515 .Pp
516 Commands and variables can be completed in much the same way.
517 For example, typing
518 .Sq em[tab]
519 would complete
520 .Sq em
521 to
522 .Sq emacs
523 if
524 .Pa emacs
525 were the only command on your system beginning with
526 .Sq em .
527 Completion can find a command in any directory in
528 .Pa path
529 or if given a full pathname.
530 Typing
531 .Sq echo $ar[tab]
532 would complete
533 .Sq $ar
534 to
535 .Sq $argv
536 if no other variable began with
537 .Sq ar .
538 .Pp
539 The shell parses the input buffer to determine whether the word you want to
540 complete should be completed as a filename, command or variable.
541 The first word in the buffer and the first word following
542 .Sq \&; ,
543 .Sq | ,
544 .Sq |& ,
545 .Sq &&
546 or
547 .Sq ||
548 is considered to be a command.
549 A word beginning with
550 .Sq $
551 is considered to be a variable.
552 Anything else is a filename.
553 An empty line is
554 .Sq completed
555 as a filename.
556 .Pp
557 You can list the possible completions of a word at any time by typing
558 .Sq ^D
559 to run the
560 .Ic delete-char-or-list-or-eof
561 editor command.
562 The shell lists the possible completions using the
563 .Ic ls\-F
564 builtin (q.v.)
565 and reprints the prompt and unfinished command line, for example:
566 .Bd -literal -offset indent
567 > ls /usr/l[^D]
568 lbin/       lib/        local/      lost+found/
569 > ls /usr/l
570 .Ed
571 .Pp
572 If the
573 .Va autolist
574 shell variable is set, the shell lists the remaining
575 choices (if any) whenever completion fails:
576 .Bd -literal -offset indent
577 > set autolist
578 > nm /usr/lib/libt[tab]
579 libtermcap.a@ libtermlib.a@
580 > nm /usr/lib/libterm
581 .Ed
582 .Pp
583 If
584 .Va autolist
585 shell variable is set to
586 .Sq ambiguous ,
587 choices are listed only when
588 completion fails and adds no new characters to the word being completed.
589 .Pp
590 A filename to be completed can contain variables, your own or others' home
591 directories abbreviated with
592 .Sq ~
593 (see
594 .Sx Filename substitution )
595 and directory stack entries abbreviated with
596 .Sq =
597 (see
598 .Sx Directory stack substitution ) .
599 For example,
600 .Bd -literal -offset indent
601 > ls ~k[^D]
602 kahn    kas     kellogg
603 > ls ~ke[tab]
604 > ls ~kellogg/
605 .Ed
606 or
607 .Bd -literal -offset indent
608 > set local = /usr/local
609 > ls $lo[tab]
610 > ls $local/[^D]
611 bin/ etc/ lib/ man/ src/
612 > ls $local/
613 .Ed
614 .Pp
615 Note that variables can also be expanded explicitly with the
616 .Ic expand-variables
617 editor command.
618 .Pp
619 .Ic delete-char-or-list-or-eof
620 lists at only the end of the line;
621 in the middle of a line it deletes the character under the cursor and
622 on an empty line it logs one out or, if then
623 .Va ignoreeof
624 variable is set, does nothing.
625 .Sq M-^D ,
626 bound to the editor command
627 .Ic list-choices ,
628 lists completion
629 possibilities anywhere on a line, and
630 .Ic list-choices
631 (or any one of the
632 related editor commands that do or don't delete, list and/or log out,
633 listed under
634 .Ic delete-char-or-list-or-eof )
635 can be bound to
636 .Sq ^D
637 with the
638 .Ic bindkey
639 builtin command if so desired.
640 .Pp
641 The
642 .Ic complete-word-fwd
643 and
644 .Ic complete-word-back
645 editor commands
646 (not bound to any keys by default) can be used to cycle up and down through
647 the list of possible completions, replacing the current word with the next or
648 previous word in the list.
649 .Pp
650 The shell variable
651 .Va fignore
652 can be set to a list of suffixes to be ignored by completion.
653 Consider the following:
654 .Bd -literal -offset indent
655 > ls
656 Makefile        condiments.h~   main.o          side.c
657 README          main.c          meal            side.o
658 condiments.h    main.c~
659 > set fignore = (.o \e~)
660 > emacs ma[^D]
661 main.c   main.c~  main.o
662 > emacs ma[tab]
663 > emacs main.c
664 .Ed
665 .Pp
666 .Sq main.c~
667 and
668 .Sq main.o
669 are ignored by completion (but not listing),
670 because they end in suffixes in
671 .Va fignore .
672 Note that a
673 .Sq \e
674 was needed in front of
675 .Sq ~
676 to prevent it from being expanded to
677 .Va home
678 as described under
679 .Sx Filename substitution .
680 .Va fignore
681 is ignored if only one completion is possible.
682 .Pp
683 If the
684 .Va complete
685 shell variable is set to
686 .Sq enhance ,
687 completion 1) ignores case and 2) considers periods, hyphens and underscores
688 .Sq ( \&. ,
689 .Sq \&-
690 and
691 .Sq _ )
692 to be word separators and hyphens and underscores to be equivalent.
693 If you had the following files
694 .Bd -literal -offset indent
695 comp.lang.c      comp.lang.perl   comp.std.c++
696 comp.lang.c++    comp.std.c
697 .Ed
698 .Pp
699 and typed
700 .Sq mail \-f c.l.c[tab] ,
701 it would be completed to
702 .Sq mail \-f comp.lang.c ,
703 and
704 .Sq ^D
705 would list
706 .Sq comp.lang.c
707 and
708 .Sq comp.lang.c++ .
709 .Sq mail \-f c..c++[^D]
710 would list
711 .Sq comp.lang.c++
712 and
713 .Sq comp.std.c++ .
714 Typing
715 .Sq rm a\-\-file[^D]
716 in the following directory
717 .Bd -literal -offset indent
718 A_silly_file    a-hyphenated-file    another_silly_file
719 .Ed
720 .Pp
721 would list all three files, because case is ignored and hyphens and
722 underscores are equivalent.
723 Periods, however, are not equivalent to
724 hyphens or underscores.
725 .Pp
726 If the
727 .Va complete
728 shell variable is set to
729 .Sq Enhance ,
730 completion
731 ignores case and differences between a hyphen and an underscore word
732 separator only when the user types a lowercase character or a hyphen.
733 Entering an uppercase character or an underscore will not match the
734 corresponding lowercase character or hyphen word separator.
735 Typing
736 .Sq rm a\-\-file[^D]
737 in the directory of the previous example would
738 still list all three files, but typing
739 .Sq rm A\-\-file
740 would match only
741 .Sq A_silly_file
742 and typing
743 .Sq rm a__file[^D]
744 would match just
745 .Sq A_silly_file
746 and
747 .Sq another_silly_file
748 because the user explicitly used an uppercase
749 or an underscore character.
750 .Pp
751 Completion and listing are affected by several other shell variables:
752 .Va recexact
753 can be set to complete on the shortest possible unique
754 match, even if more typing might result in a longer match:
755 .Bd -literal -offset indent
756 > ls
757 fodder   foo      food     foonly
758 > set recexact
759 > rm fo[tab]
760 .Ed
761 .Pp
762 just beeps, because
763 .Sq fo
764 could expand to
765 .Sq fod
766 or
767 .Sq foo ,
768 but if we type another
769 .Sq o ,
770 .Bd -literal -offset indent
771 > rm foo[tab]
772 > rm foo
773 .Ed
774 .Pp
775 the completion completes on
776 .Sq foo ,
777 even though
778 .Sq food
779 and
780 .Sq foonly
781 also match.
782 .Va autoexpand
783 can be set to run the
784 .Ic expand-history
785 editor command
786 before each completion attempt,
787 .Va autocorrect
788 can be set to
789 spelling-correct the word to be completed (see
790 .Sx Spelling correction )
791 before each completion attempt and
792 .Va correct
793 can be set to complete commands automatically after one hits
794 .Sq return .
795 .Va matchbeep
796 can be set to make completion beep or not beep in a variety
797 of situations, and
798 .Va nobeep
799 can be set to never beep at all.
800 .Va nostat
801 can be set to a list of directories and/or patterns that
802 match directories to prevent the completion mechanism from
803 .Xr stat 2
804 ing
805 those directories.
806 .Va listmax
807 and
808 .Va listmaxrows
809 can be set to limit the number of items
810 and rows (respectively) that are listed without asking first.
811 .Va recognize_only_executables
812 can be set to make the shell list only
813 executables when listing commands, but it is quite slow.
814 .Pp
815 Finally, the
816 .Ic complete
817 builtin command can be used to tell the shell how
818 to complete words other than filenames, commands and variables.
819 Completion and listing do not work on glob-patterns (see
820 .Sx Filename substitution ) ,
821 but the
822 .Ic list-glob
823 and
824 .Ic expand-glob
825 editor commands perform
826 equivalent functions for glob-patterns.
827 .Ss Spelling correction (+)
828 The shell can sometimes correct the spelling of filenames, commands and
829 variable names as well as completing and listing them.
830 .Pp
831 Individual words can be spelling-corrected with the
832 .Ic spell-word
833 editor command (usually bound to M-s and M-S)
834 and the entire input buffer with
835 .Ic spell-line
836 (usually bound to M-$).
837 The
838 .Va correct
839 shell variable can be set to
840 .Dv cmd
841 to correct the command name or
842 .Dv all
843 to correct the entire line each time return is typed, and
844 .Va autocorrect
845 can be set to correct the word to be completed
846 before each completion attempt.
847 .Pp
848 When spelling correction is invoked in any of these ways and
849 the shell thinks that any part of the command line is misspelled,
850 it prompts with the corrected line:
851 .Bd -literal -offset indent
852 > set correct = cmd
853 > lz /usr/bin
854 CORRECT>ls /usr/bin (y|n|e|a)?
855 .Ed
856 .Pp
857 One can answer
858 .Sq y
859 or space to execute the corrected line,
860 .Sq e
861 to leave the uncorrected command in the input buffer,
862 .Sq a
863 to abort the command as if
864 .Sq ^C
865 had been hit, and
866 anything else to execute the original line unchanged.
867 .Pp
868 Spelling correction recognizes user-defined completions (see the
869 .Ic complete
870 builtin command).
871 If an input word in a position for
872 which a completion is defined resembles a word in the completion list,
873 spelling correction registers a misspelling and suggests the latter
874 word as a correction.
875 However, if the input word does not match any of
876 the possible completions for that position, spelling correction does
877 not register a misspelling.
878 .Pp
879 Like completion, spelling correction works anywhere in the line,
880 pushing the rest of the line to the right and possibly leaving
881 extra characters to the right of the cursor.
882 .Ss Editor commands (+)
883 .Ic bindkey
884 lists key bindings and
885 .Ic bindkey \-l
886 lists and briefly describes editor commands.
887 Only new or especially interesting editor commands are described here.
888 See
889 .Xr emacs 1
890 and
891 .Xr vi 1
892 for descriptions of each editor's key bindings.
893 .Pp
894 The character or characters to which each command is bound by default is
895 given in parentheses.
896 .Sq ^character
897 means a control character and
898 .Sq M-character
899 a meta character, typed as
900 .Sq escape-character
901 on terminals without a meta key.
902 Case counts, but commands that are bound
903 to letters by default are bound to both lower- and uppercase letters for
904 convenience.
905 .Bl -tag -width indent
906 .It Ic backward-char Ar (^B, left)
907 Move back a character.
908 Cursor behavior modified by
909 .Va vimode
910 .It Ic backward-delete-word Ar (M-^H, M-^?)
911 Cut from beginning of current word to cursor \- saved in cut buffer.
912 Word boundary behavior modified by
913 .Va vimode
914 .It Ic backward-word Ar (M-b, M-B)
915 Move to beginning of current word.
916 Word boundary and cursor behavior modified by
917 .Va vimode
918 .It Ic beginning-of-line Ar (^A, home)
919 Move to beginning of line.
920 Cursor behavior modified by
921 .Va vimode
922 .It Ic capitalize-word Ar (M-c, M-C)
923 Capitalize the characters from cursor to end of current word.
924 Word boundary behavior modified by
925 .Va vimode
926 .It Ic complete-word Ar (tab)
927 Completes a word as described under
928 .Sx Completion and listing
929 .It Ic complete-word-back Ar (not bound)
930 Like
931 .Ic complete-word-fwd ,
932 but steps up from the end of the list.
933 .It Ic complete-word-fwd Ar (not bound)
934 Replaces the current word with the first word in the list of possible
935 completions.
936 May be repeated to step down through the list.
937 At the end of the list, beeps and reverts to the incomplete word.
938 .It Ic complete-word-raw Ar (^X-tab)
939 Like
940 .Ic complete-word ,
941 but ignores user-defined completions.
942 .It Ic copy-prev-word Ar (M-^_)
943 Copies the previous word in the current line into the input buffer.
944 See also
945 .Ic insert-last-word
946 Word boundary behavior modified by
947 .Va vimode
948 .It Ic dabbrev-expand Ar (M-/)
949 Expands the current word to the most recent preceding one for which
950 the current is a leading substring, wrapping around the history list
951 (once) if necessary.
952 Repeating
953 .Ic dabbrev-expand
954 without any intervening typing
955 changes to the next previous word etc., skipping identical matches
956 much like
957 .Ic history-search-backward
958 does.
959 .It Ic delete-char Ar (not bound)
960 Deletes the character under the cursor.
961 See also
962 .Ic delete-char-or-list-or-eof
963 Cursor behavior modified by
964 .Va vimode
965 .It Ic delete-char-or-eof Ar (not bound)
966 Does
967 .Ic delete-char
968 if there is a character under the cursor or
969 .Ic end-of-file
970 on an empty line.
971 See also
972 .Ic delete-char-or-list-or-eof
973 Cursor behavior modified by
974 .Va vimode
975 .It Ic delete-char-or-list Ar (not bound)
976 Does
977 .Ic delete-char
978 if there is a character under the cursor
979 or
980 .Ic list-choices
981 at the end of the line.
982 See also
983 .Ic delete-char-or-list-or-eof
984 .It Ic delete-char-or-list-or-eof Ar (^D)
985 Does
986 .Ic delete-char
987 if there is a character under the cursor,
988 .Ic list-choices
989 at the end of the line or
990 .Ic end-of-file
991 on an empty line.
992 See also those three commands, each of which does only a single action, and
993 .Ic delete-char-or-eof ,
994 .Ic delete-char-or-list
995 and
996 .Ic list-or-eof ,
997 each of which does a different two out of the three.
998 .It Ic delete-word Ar (M-d, M-D)
999 Cut from cursor to end of current word \- save in cut buffer.
1000 Word boundary behavior modified by
1001 .Va vimode
1002 .It Ic down-history Ar (down-arrow, ^N)
1003 Like
1004 .Ic up-history ,
1005 but steps down, stopping at the original input line.
1006 .It Ic downcase-word Ar (M-l, M-L)
1007 Lowercase the characters from cursor to end of current word.
1008 Word boundary behavior modified by
1009 .Va vimode
1010 .It Ic end-of-file Ar (not bound)
1011 Signals an end of file, causing the shell to exit unless the
1012 .Va ignoreeof
1013 shell variable (q.v.) is set to prevent this.
1014 See also
1015 .Ic delete-char-or-list-or-eof
1016 .It Ic end-of-line Ar (^E, end)
1017 Move cursor to end of line.
1018 Cursor behavior modified by
1019 .Va vimode
1020 .It Ic expand-history Ar (M-space)
1021 Expands history substitutions in the current word.
1022 See
1023 .Sx History substitution
1024 See also
1025 .Ic magic-space ,
1026 .Ic toggle-literal-history
1027 and the
1028 .Va autoexpand
1029 shell variable.
1030 .It Ic expand-glob Ar (^X-*)
1031 Expands the glob-pattern to the left of the cursor.
1032 See
1033 .Sx Filename substitution
1034 .It Ic expand-line Ar (not bound)
1035 Like
1036 .Ic expand-history ,
1037 but expands history substitutions in each word in the input buffer.
1038 .It Ic expand-variables Ar (^X-$)
1039 Expands the variable to the left of the cursor.
1040 See
1041 .Sx Variable substitution
1042 .It Ic forward-char Ar (^F, right)
1043 Move forward one character.
1044 Cursor behavior modified by
1045 .Va vimode
1046 .It Ic forward-word Ar (M-f, M-F)
1047 Move forward to end of current word.
1048 Word boundary and cursor behavior modified by
1049 .Va vimode
1050 .It Ic history-search-backward Ar (M-p, M-P)
1051 Searches backwards through the history list for a command beginning with
1052 the current contents of the input buffer up to the cursor and copies it
1053 into the input buffer.
1054 The search string may be a glob-pattern (see
1055 .Sx Filename substitution )
1056 containing
1057 .Sq * ,
1058 .Sq \&?  ,
1059 .Sq []
1060 or
1061 .Sq {}
1062 .Ic up-history
1063 and
1064 .Ic down-history
1065 will proceed from the
1066 appropriate point in the history list.
1067 Emacs mode only.
1068 See also
1069 .Ic history-search-forward
1070 and
1071 .Ic i-search-back
1072 .It Ic history-search-forward Ar (M-n, M-N)
1073 Like
1074 .Ic history-search-backward ,
1075 but searches forward.
1076 .It Ic i-search-back Ar (not bound)
1077 Searches backward like
1078 .Ic history-search-backward ,
1079 copies the first match
1080 into the input buffer with the cursor positioned at the end of the pattern,
1081 and prompts with
1082 .Sq bck:
1083 and the first match.
1084 Additional characters may be
1085 typed to extend the search,
1086 .Ic i-search-back
1087 may be typed to continue
1088 searching with the same pattern, wrapping around the history list if
1089 necessary,
1090 .Ic ( i-search-back
1091 must be bound to a
1092 single character for this to work) or one of the following special characters
1093 may be typed:
1094 .Pp
1095 .Bl -tag -width indent -compact
1096 .It ^W
1097 Appends the rest of the word under the cursor to the search pattern.
1098 .It delete
1099 (or any character bound to
1100 .Ic backward-delete-char )
1101 Undoes the effect of the last character typed and deletes a character
1102 from the search pattern if appropriate.
1103 .It ^G
1104 If the previous search was successful, aborts the entire search.
1105 If not, goes back to the last successful search.
1106 .It escape
1107 Ends the search, leaving the current line in the input buffer.
1108 .El
1109 .Pp
1110 Any other character not bound to
1111 .Ic self-insert-command
1112 terminates the
1113 search, leaving the current line in the input buffer, and
1114 is then interpreted as normal input.
1115 In particular, a carriage return
1116 causes the current line to be executed.
1117 See also
1118 .Ic i-search-fwd
1119 and
1120 .Ic history-search-backward
1121 Word boundary behavior modified by
1122 .Va vimode
1123 .It Ic i-search-fwd Ar (not bound)
1124 Like
1125 .Ic i-search-back ,
1126 but searches forward.
1127 Word boundary behavior modified by
1128 .Va vimode
1129 .It Ic insert-last-word Ar (M-_)
1130 Inserts the last word of the previous input line
1131 .Sq ( \&!$ )
1132 into the input buffer.
1133 See also
1134 .Ic copy-prev-word
1135 .It Ic list-choices Ar (M-^D)
1136 Lists completion possibilities as described under
1137 .Sx Completion and listing
1138 See also
1139 .Ic delete-char-or-list-or-eof
1140 and
1141 .Ic list-choices-raw
1142 .It Ic list-choices-raw Ar (^X-^D)
1143 Like
1144 .Ic list-choices ,
1145 but ignores user-defined completions.
1146 .It Ic list-glob Ar (^X-g, ^X-G)
1147 Lists (via the
1148 .Ic ls\-F
1149 builtin) matches to the glob-pattern
1150 (see
1151 .Sx Filename substitution )
1152 to the left of the cursor.
1153 .It Ic list-or-eof Ar (not bound)
1154 Does
1155 .Ic list-choices
1156 or
1157 .Ic end-of-file
1158 on an empty line.
1159 See also
1160 .Ic delete-char-or-list-or-eof
1161 .It Ic magic-space Ar (not bound)
1162 Expands history substitutions in the current line,
1163 like
1164 .Ic expand-history ,
1165 and inserts a space.
1166 .Ic magic-space
1167 is designed to be bound to the space bar,
1168 but is not bound by default.
1169 .It Ic normalize-command Ar (^X-?)
1170 Searches for the current word in PATH and, if it is found, replaces it with
1171 the full path to the executable.
1172 Special characters are quoted.
1173 Aliases are
1174 expanded and quoted but commands within aliases are not.
1175 This command is
1176 useful with commands that take commands as arguments, e.g.,
1177 .Sq dbx
1178 and
1179 .Sq sh \-x
1180 .It Ic normalize-path Ar (^X-n, ^X-N)
1181 Expands the current word as described under the
1182 .Sq expand
1183 setting
1184 of the
1185 .Va symlinks
1186 shell variable.
1187 .It Ic overwrite-mode Ar (unbound)
1188 Toggles between input and overwrite modes.
1189 .It Ic run-fg-editor Ar (M-^Z)
1190 Saves the current input line and
1191 looks for a stopped job where the file name portion of its first word
1192 is found in the
1193 .Va editors
1194 shell variable.
1195 If
1196 .Va editors
1197 is not set, then the file name portion of the
1198 .Va EDITOR
1199 environment variable
1200 .Sq ( ed
1201 if unset)
1202 and the
1203 .Va VISUAL
1204 environment variable
1205 Sq ( vi
1206 if unset)
1207 will be used.
1208 If such a job is found, it is restarted as if
1209 .Sq fg %
1210 .Ic job
1211 had been typed.
1212 This is used to toggle back and forth between an editor and
1213 the shell easily.
1214 Some people bind this command to
1215 .Sq ^Z
1216 so they
1217 can do this even more easily.
1218 .It Ic run-help Ar (M-h, M-H)
1219 Searches for documentation on the current command, using the same notion of
1220 .Sq current command
1221 as the completion routines, and prints it.
1222 There is no way
1223 to use a pager;
1224 .Ic run-help
1225 is designed for short help files.
1226 If the special alias
1227 .Va helpcommand
1228 is defined, it is run with the
1229 command name as a sole argument.
1230 Else,
1231 documentation should be in a file named
1232 .Sq command.help ,
1233 .Sq command.1 ,
1234 .Sq command.6 ,
1235 .Sq command.8 ,
1236 or
1237 .Sq command ,
1238 which should be in one
1239 of the directories listed in the
1240 .Va HPATH
1241 environment variable.
1242 If there is more than one help file only the first is printed.
1243 .It Ic self-insert-command Ar (text characters)
1244 In insert mode (the default), inserts the typed character into the input line after the character under the cursor.
1245 In overwrite mode, replaces the character under the cursor with the typed character.
1246 The input mode is normally preserved between lines, but the
1247 .Va inputmode
1248 shell variable can be set to
1249 .Dv insert
1250 or
1251 .Dv overwrite
1252 to put the
1253 editor in that mode at the beginning of each line.
1254 See also
1255 .Ic overwrite-mode
1256 .It Ic sequence-lead-in Ar (arrow prefix, meta prefix, ^X)
1257 Indicates that the following characters are part of a
1258 multi-key sequence.
1259 Binding a command to a multi-key sequence really creates
1260 two bindings: the first character to
1261 .Ic sequence-lead-in
1262 and the
1263 whole sequence to the command.
1264 All sequences beginning with a character
1265 bound to
1266 .Ic sequence-lead-in
1267 are effectively bound to
1268 .Ic undefined-key
1269 unless bound to another command.
1270 .It Ic spell-line Ar (M-$)
1271 Attempts to correct the spelling of each word in the input buffer, like
1272 .Ic spell-word ,
1273 but ignores words whose first character is one of
1274 .Sq \- ,
1275 .Sq \ ! ,
1276 .Sq ^
1277 or
1278 .Sq % ,
1279 or which contain
1280 .Sq \e ,
1281 .Sq *
1282 or
1283 .Sq \&? ,
1284 to avoid problems with switches, substitutions and the like.
1285 See
1286 .Sx Spelling correction
1287 .It Ic spell-word Ar (M-s, M-S)
1288 Attempts to correct the spelling of the current word as described under
1289 .Sx Spelling correction
1290 Checks each component of a word which appears to be a pathname.
1291 .It Ic toggle-literal-history Ar (M-r, M-R)
1292 Expands or
1293 .Sq unexpands
1294 history substitutions in the input buffer.
1295 See also
1296 .Ic expand-history
1297 and the
1298 .Va autoexpand
1299 shell variable.
1300 .It Ic undefined-key Ar (any unbound key)
1301 Beeps.
1302 .It Ic up-history Ar (up-arrow, ^P)
1303 Copies the previous entry in the history list into the input buffer.
1304 If
1305 .Va histlit
1306 is set, uses the literal form of the entry.
1307 May be repeated to step up through the history list, stopping at the top.
1308 .It Ic upcase-word Ar (M-u, M-U)
1309 Uppercase the characters from cursor to end of current word.
1310 Word boundary behavior modified by
1311 .Va vimode
1312 .It Ic vi-beginning-of-next-word Ar (not bound)
1313 Vi goto the beginning of next word.
1314 Word boundary and cursor behavior modified by
1315 .Va vimode
1316 .It Ic vi-eword Ar (not bound)
1317 Vi move to the end of the current word.
1318 Word boundary behavior modified by
1319 .Va vimode
1320 .It Ic vi-search-back Ar (?)
1321 Prompts with
1322 .Sq \&?
1323 for a search string (which may be a glob-pattern, as with
1324 .Ic history-search-backward ),
1325 searches for it and copies it into the input buffer.
1326 The bell rings if no match is found.
1327 Hitting return ends the search and leaves the last match in the input
1328 buffer.
1329 Hitting escape ends the search and executes the match.
1330 .Ic vi
1331 mode only.
1332 .It Ic vi-search-fwd Ar (/)
1333 Like
1334 .Ic vi-search-back ,
1335 but searches forward.
1336 .It Ic which-command Ar (M-?)
1337 Does a
1338 .Ic which
1339 (see the description of the builtin command) on the
1340 first word of the input buffer.
1341 .It Ic yank-pop Ar (M-y)
1342 When executed immediately after a
1343 .Ic yank
1344 or another
1345 .Ic yank-pop ,
1346 replaces the yanked string with the next previous string from the
1347 killring. This also has the effect of rotating the killring, such that
1348 this string will be considered the most recently killed by a later
1349 .Ic yank
1350 command. Repeating
1351 .Ic yank-pop
1352 will cycle through the
1353 killring any number of times.
1354 .El
1355 .Ss Lexical structure
1356 The shell splits input lines into words at blanks and tabs.
1357 The special
1358 characters
1359 .Sq \&& ,
1360 .Sq | ,
1361 .Sq \&; ,
1362 .Sq < ,
1363 .Sq > ,
1364 .Sq \&( ,
1365 and
1366 .Sq \&)
1367 and the doubled characters
1368 .Sq && ,
1369 .Sq || ,
1370 .Sq <<
1371 and
1372 .Sq >>
1373 are always separate words, whether or not they are
1374 surrounded by whitespace.
1375 .Pp
1376 When the shell's input is not a terminal, the character
1377 .Sq #
1378 is taken to begin a
1379 comment.
1380 Each
1381 .Sq #
1382 and the rest of the input line on which it appears is
1383 discarded before further parsing.
1384 .Pp
1385 A special character (including a blank or tab) may be prevented from having
1386 its special meaning, and possibly made part of another word, by preceding it
1387 with a backslash
1388 .Sq ( \e )
1389 or enclosing it in single
1390 .Sq ( \&' ) ,
1391 , double
1392 .Sq ( \&" )
1393 or
1394 backward
1395 .Sq ( \&` )
1396 quotes.
1397 When not otherwise quoted a newline preceded by a
1398 .Sq \e
1399 is equivalent to a blank, but inside quotes this sequence results in a
1400 newline.
1401 .Pp
1402 Furthermore, all
1403 .Sx Substitutions
1404 (see below) except
1405 .Sx History substitution
1406 can be prevented by enclosing the strings (or parts of strings)
1407 in which they appear with single quotes or by quoting the crucial character(s)
1408 (e.g.,
1409 .Sq $
1410 or
1411 .Sq \&`
1412 for
1413 .Sx Variable substitution
1414 or
1415 .Sx Command substitution
1416 respectively)
1417 with
1418 .Sq \e
1419 .Sx ( Alias substitution
1420 is no exception: quoting in any way any
1421 character of a word for which an
1422 .Va alias
1423 has been defined prevents
1424 substitution of the alias.
1425 The usual way of quoting an alias is to precede it
1426 with a backslash.)
1427 .Sx History substitution
1428 is prevented by
1429 backslashes but not by single quotes.
1430 Strings quoted with double or backward
1431 quotes undergo
1432 .Sx Variable substitution
1433 and
1434 .Sx Command substitution ,
1435 but other substitutions are prevented.
1436 .Pp
1437 Text inside single or double quotes becomes a single word (or part of one).
1438 Metacharacters in these strings, including blanks and tabs, do not form
1439 separate words.
1440 Only in one special case (see
1441 .Sx Command substitution
1442 below) can a double-quoted string yield parts of more than one word;
1443 single-quoted strings never do.
1444 Backward quotes are special: they signal
1445 .Sx Command substitution
1446 (q.v.), which may result in more than one word.
1447 .Pp
1448 Quoting complex strings, particularly strings which themselves contain quoting
1449 characters, can be confusing.
1450 Remember that quotes need not be used as they are
1451 in human writing!
1452 It may be easier to quote not an entire string, but only
1453 those parts of the string which need quoting, using different types of quoting
1454 to do so if appropriate.
1455 .Pp
1456 The
1457 .Va backslash_quote
1458 shell variable (q.v.) can be set to make backslashes
1459 always quote
1460 .Sq \e ,
1461 .Sq \&' ,
1462 and
1463 .Sq \&"
1464 (+) This may make complex quoting tasks
1465 easier, but it can cause syntax errors in
1466 .Xr csh 1
1467 scripts.
1468 .Ss Substitutions
1469 We now describe the various transformations the shell performs on the input in
1470 the order in which they occur.
1471 We note in passing the data structures involved
1472 and the commands and variables which affect them.
1473 Remember that substitutions
1474 can be prevented by quoting as described under
1475 .Sx Lexical structure .
1476 .Ss History substitution
1477 Each command, or
1478 .Sq event ,
1479 input from the terminal is saved in the history list.
1480 The previous command is always saved, and the
1481 .Va history
1482 shell
1483 variable can be set to a number to save that many commands.
1484 The
1485 .Va histdup
1486 shell variable can be set to not save duplicate events or consecutive duplicate
1487 events.
1488 .Pp
1489 Saved commands are numbered sequentially from 1 and stamped with the time.
1490 It is not usually necessary to use event numbers, but the current event number
1491 can be made part of the prompt by placing an
1492 .Sq \&!
1493 in the
1494 .Va prompt
1495 shell variable.
1496 .Pp
1497 The shell actually saves history in expanded and literal (unexpanded) forms.
1498 If the
1499 .Va histlit
1500 shell variable is set, commands that display and store
1501 history use the literal form.
1502 .Pp
1503 The
1504 .Va history
1505 builtin command can print, store in a file, restore
1506 and clear the history list at any time,
1507 and the
1508 .Va savehist
1509 and
1510 .Va histfile
1511 shell variables can be set to
1512 store the history list automatically on logout and restore it on login.
1513 .Pp
1514 History substitutions introduce words from the history list into the input
1515 stream, making it easy to repeat commands, repeat arguments of a previous
1516 command in the current command, or fix spelling mistakes in the previous
1517 command with little typing and a high degree of confidence.
1518 .Pp
1519 History substitutions begin with the character
1520 .Sq \&!
1521 They may begin anywhere in
1522 the input stream, but they do not nest.
1523 The
1524 .Sq \&!
1525 may be preceded by a
1526 .Sq \e
1527 to
1528 prevent its special meaning; for convenience, a
1529 .Sq \&!
1530 is passed unchanged when it
1531 is followed by a blank, tab, newline,
1532 .Sq =
1533 or
1534 .Sq \&(
1535 History substitutions also
1536 occur when an input line begins with
1537 .Sq ^
1538 This special abbreviation will be
1539 described later.
1540 The characters used to signal history substitution 
1541 .Sq ( \&!
1542 and
1543 .Sq ^ )
1544 can be changed by setting the
1545 .Va histchars
1546 shell variable.
1547 Any input
1548 line which contains a history substitution is printed before it is executed.
1549 .Pp
1550 A history substitution may have an
1551 .Sq event specification ,
1552 which indicates the event from which words are to be taken, a
1553 .Sq word designator ,
1554 which selects particular words from the chosen event, and/or a
1555 .Sq modifier ,
1556 which manipulates the selected words.
1557 .Pp
1558 An event specification can be
1559 .Pp
1560 .Bl -tag -width XXXX -offset indent -compact
1561 .It Ar n
1562 A number, referring to a particular event
1563 .It Ar \-n
1564 An offset, referring to the event
1565 .Ar n
1566 before the current event
1567 .It Ar #
1568 The current event.
1569 This should be used carefully in
1570 .Xr csh 1 ,
1571 where there is no check for recursion.
1572 .Nm
1573 allows 10 levels of recursion.
1574 (+)
1575 .It Ar \&!
1576 The previous event (equivalent to
1577 .Sq \-1 )
1578 .It Ar s
1579 The most recent event whose first word begins with the string
1580 .Va s
1581 .It Ar ?s?
1582 The most recent event which contains the string
1583 .Va s
1584 The second
1585 .Sq \&?
1586 can be omitted if it is immediately followed by a newline.
1587 .El
1588 .Pp
1589 For example, consider this bit of someone's history list:
1590 .Bd -literal -offset indent
1591  9  8:30    nroff \-man wumpus.man
1592 10  8:31    cp wumpus.man wumpus.man.old
1593 11  8:36    vi wumpus.man
1594 12  8:37    diff wumpus.man.old wumpus.man
1595 .Ed
1596 .Pp
1597 The commands are shown with their event numbers and time stamps.
1598 The current event, which we haven't typed in yet, is event 13.
1599 .Sq !11
1600 and
1601 .Sq !\-2
1602 refer to event 11.
1603 .Sq \&!!
1604 refers to the previous event, 12.
1605 .Sq \&!!
1606 can be abbreviated
1607 .Sq \&!
1608 if it is
1609 followed by
1610 .Sq \&: 
1611 .Sq ( \&:
1612 is described below).
1613 .Sq !n
1614 refers to event 9, which begins with
1615 .Sq n
1616 .Sq !?old?
1617 also refers to event 12, which contains
1618 .Sq old
1619 Without word designators or modifiers history references simply expand to the
1620 entire event, so we might type
1621 .Sq !cp
1622 to redo the copy command or
1623 .Sq !!|more
1624 if the
1625 .Sq diff
1626 output scrolled off the top of the screen.
1627 .Pp
1628 History references may be insulated from the surrounding text with braces if
1629 necessary.
1630 For example,
1631 .Sq !vdoc
1632 would look for a command beginning with
1633 .Sq vdoc ,
1634 and, in this example, not find one, but
1635 .Sq !{v}doc
1636 would expand
1637 unambiguously to
1638 .Sq vi wumpus.mandoc
1639 Even in braces, history substitutions do not nest.
1640 .Pp
1641 (+) While
1642 .Xr csh 1
1643 expands, for example,
1644 .Sq !3d
1645 to event 3 with the
1646 letter
1647 .Sq d
1648 appended to it,
1649 .Nm
1650 expands it to the last event beginning
1651 with
1652 .Sq 3d ;
1653 only completely numeric arguments are treated as event numbers.
1654 This makes it possible to recall events beginning with numbers.
1655 To expand
1656 .Sq !3d
1657 as in
1658 .Xr csh 1
1659 say
1660 .Sq !{3}d
1661 .Pp
1662 To select words from an event we can follow the event specification by a
1663 .Sq \&:
1664 and a designator for the desired words.
1665 The words of an input line are
1666 numbered from 0, the first (usually command) word being 0, the second word
1667 (first argument) being 1, etc.
1668 The basic word designators are:
1669 .Pp
1670 .Bl -tag -width XXXX -offset indent -compact
1671 .It Ar 0
1672 The first (command) word
1673 .It Ar n
1674 The
1675 .Va n
1676 th argument
1677 .It Ar ^
1678 The first argument, equivalent to
1679 .Sq 1
1680 .It Ar $
1681 The last argument
1682 .It Ar %
1683 The word matched by an ?
1684 .Va s
1685 ? search
1686 .It Ar x\-y
1687 A range of words
1688 .It Ar \-y
1689 Equivalent to
1690 .Sq 0\-y
1691 .It Ar *
1692 Equivalent to
1693 .Sq ^\-$ ,
1694 but returns nothing if the event contains only 1 word
1695 .It Ar x*
1696 Equivalent to
1697 .Sq x\-$
1698 .It Ar x\-
1699 Equivalent to
1700 .Sq x* ,
1701 but omitting the last word
1702 .Sq ( $ )
1703 .El
1704 .Pp
1705 Selected words are inserted into the command line separated by single blanks.
1706 For example, the
1707 .Sq diff
1708 command in the previous example might have been
1709 typed as
1710 .Sq diff !!:1.old !!:1
1711 (using
1712 .Sq \&:1
1713 to select the first argument
1714 from the previous event) or
1715 .Sq diff !\-2:2 !\-2:1
1716 to select and swap the
1717 arguments from the
1718 .Sq cp
1719 command.
1720 If we didn't care about the order of the
1721 `diff' we might have said
1722 .Sq diff !\-2:1\-2
1723 or simply
1724 .Sq diff !\-2:*
1725 The
1726 .Sq cp
1727 command might have been written
1728 .Sq cp wumpus.man !#:1.old
1729 , using
1730 .Sq #
1731 to refer to the current event.
1732 `!n:\- hurkle.man' would reuse the first two words from the
1733 .Sq nroff
1734 command
1735 to say
1736 .Sq nroff \-man hurkle.man
1737 .Pp
1738 The
1739 .Sq \&:
1740 separating the event specification from the word designator can be
1741 omitted if the argument selector begins with a
1742 .Sq ^ ,
1743 .Sq $ ,
1744 .Sq * ,
1745 .Sq %
1746 or
1747 .Sq \&-
1748 For example, our
1749 .Sq diff
1750 command might have been
1751 .Sq diff !!^.old !!^
1752 or,
1753 equivalently,
1754 .Sq diff !!$.old !!$
1755 However, if
1756 .Sq \&!!
1757 is abbreviated
1758 .Sq \&!
1759 ,
1760 an argument selector beginning with
1761 .Sq \-
1762 will be interpreted as an event
1763 specification.
1764 .Pp
1765 A history reference may have a word designator but no event specification.
1766 It then references the previous command.
1767 Continuing our
1768 .Sq diff
1769 example, we could have said simply `diff
1770 !^.old !^' or, to get the arguments in the opposite order, just
1771 .Sq diff !*
1772 .Pp
1773 The word or words in a history reference can be edited, or
1774 .Sq `modified
1775 ',
1776 by following it with one or more modifiers, each preceded by a
1777 .Sq \&: :
1778 .Pp
1779 .Bl -tag -width XXXXXX -offset indent -compact
1780 .It Ar h
1781 Remove a trailing pathname component, leaving the head.
1782 .It Ar t
1783 Remove all leading pathname components, leaving the tail.
1784 .It Ar r
1785 Remove a filename extension
1786 .Sq .xxx ,
1787 leaving the root name.
1788 .It Ar e
1789 Remove all but the extension.
1790 .It Ar u
1791 Uppercase the first lowercase letter.
1792 .It Ar l
1793 Lowercase the first uppercase letter.
1794 .It Ar s/l/r/
1795 Substitute
1796 .Ar l
1797 for
1798 .Ar r
1799 .Ar l
1800 is simply a string like
1801 .Ar r
1802 , not a regular expression as in
1803 the eponymous
1804 .Xr ed 1
1805 command.
1806 Any character may be used as the delimiter in place of
1807 .Sq / ;
1808 a
1809 .Sq \e
1810 can be used to quote the delimiter inside
1811 .Va l
1812 and
1813 .Va r
1814 The character
1815 .Sq &
1816 in the
1817 .Va r
1818 is replaced by
1819 .Va l ;
1820 .Sq \e
1821 also quotes
1822 .Sq &
1823 If
1824 .Va l
1825 is empty (
1826 .Dq \& ) ,
1827 the
1828 .Va l
1829 from a previous substitution or the
1830 .Va s
1831 from a previous search or event number in event specification is used.
1832 The trailing delimiter may be omitted if it is immediately followed by a
1833 newline.
1834 .It Ar \&&
1835 Repeat the previous substitution.
1836 .It Ar g
1837 Apply the following modifier once to each word.
1838 .It Ar a (+)
1839 Apply the following modifier as many times as possible to a single word.
1840 .Sq a
1841 and
1842 .Sq g
1843 can be used together to apply a modifier globally.
1844 With the
1845 .Sq s
1846 modifier, only the patterns contained in the original word are
1847 substituted, not patterns that contain any substitution result.
1848 .It Ar p
1849 Print the new command line but do not execute it.
1850 .It Ar q
1851 Quote the substituted words, preventing further substitutions.
1852 .It Ar x
1853 Like 
1854 .Ar q ,
1855 but break into words at blanks, tabs and newlines.
1856 .El
1857 .Pp
1858 Modifiers are applied to only the first modifiable word (unless
1859 .Sq g
1860 is used).
1861 It is an error for no word to be modifiable.
1862 .Pp
1863 For example, the
1864 .Sq diff
1865 command might have been written as `diff wumpus.man.old
1866 !#^:r', using
1867 .Sq \&:r
1868 to remove
1869 .Sq .old
1870 from the first argument on the same line
1871 (`!#^').
1872 We could say
1873 .Sq echo hello out there
1874 , then
1875 .Sq echo !*:u
1876 to capitalize
1877 `hello',
1878 .Sq echo !*:au
1879 to say it out loud, or
1880 .Sq echo !*:agu
1881 to really shout.
1882 We might follow
1883 .Sq mail \-s "I forgot my password" rot
1884 with
1885 .Sq !:s/rot/root
1886 to
1887 correct the spelling of
1888 .Sq root
1889 (but see
1890 .Sx Spelling correction
1891 for a
1892 different approach).
1893 .Pp
1894 There is a special abbreviation for substitutions.
1895 .Sq ^ ,
1896 when it is the first character on an input line, is equivalent to
1897 .Sq !:s^
1898 Thus we might have said
1899 .Sq ^rot^root
1900 to make the spelling correction in the
1901 previous example.
1902 This is the only history substitution which does not explicitly begin with
1903 .Sq \&!
1904 .Pp
1905 (+) In
1906 .Xr csh 1
1907 as such, only one modifier may be applied to each history
1908 or variable expansion.
1909 In
1910 .Nm ,
1911 more than one may be used, for example
1912 .Bd -literal -offset indent
1913 % mv wumpus.man /usr/man/man1/wumpus.1
1914 % man !$:t:r
1915 man wumpus
1916 .Ed
1917 .Pp
1918 In
1919 .Xr csh 1 ,
1920 the result would be
1921 .Sq wumpus.1:r
1922 A substitution followed by a
1923 colon may need to be insulated from it with braces:
1924 .Bd -literal -offset indent
1925 > mv a.out /usr/games/wumpus
1926 > setenv PATH !$:h:$PATH
1927 Bad ! modifier: $.
1928 > setenv PATH !{\-2$:h}:$PATH
1929 setenv PATH /usr/games:/bin:/usr/bin:.
1930 .Ed
1931 .Pp
1932 The first attempt would succeed in
1933 .Xr csh 1
1934 but fails in
1935 .Nm ,
1936 because
1937 .Nm
1938 expects another modifier after the second colon
1939 rather than
1940 .Sq $
1941 .Pp
1942 Finally, history can be accessed through the editor as well as through
1943 the substitutions just described.
1944 The
1945 .Ic up-
1946 and
1947 .Ic down-history ,
1948 .Ic history-search-backward
1949 and
1950 .Va -forward ,
1951 .Ic i-search-back
1952 and
1953 .Ic -fwd ,
1954 .Ic vi-search-back
1955 and
1956 .Ic -fwd ,
1957 .Ic copy-prev-word
1958 and
1959 .Ic insert-last-word
1960 editor commands search for
1961 events in the history list and copy them into the input buffer.
1962 The
1963 .Ic toggle-literal-history
1964 editor command switches between the
1965 expanded and literal forms of history lines in the input buffer.
1966 .Ic expand-history
1967 and
1968 .Ic expand-line
1969 expand history substitutions
1970 in the current word and in the entire input buffer respectively.
1971 .Ss Alias substitution
1972 The shell maintains a list of aliases which can be set, unset and printed by
1973 the
1974 .Ic alias
1975 and
1976 .Ic unalias
1977 commands.
1978 After a command line is parsed
1979 into simple commands (see
1980 .Sx Commands )
1981 the first word of each command,
1982 left-to-right, is checked to see if it has an alias.
1983 If so, the first word is
1984 replaced by the alias.
1985 If the alias contains a history reference, it undergoes
1986 .Va History substitution
1987 (q.v.) as though the original command were the
1988 previous input line.
1989 If the alias does not contain a history reference, the
1990 argument list is left untouched.
1991 .Pp
1992 Thus if the alias for
1993 .Sq ls
1994 were
1995 .Sq ls \-l
1996 the command
1997 .Sq ls /usr
1998 would become `ls
1999 \-l /usr', the argument list here being undisturbed.
2000 If the alias for
2001 .Sq lookup
2002 were
2003 .Sq grep !/etc/passwd
2004 then
2005 .Sq lookup bill
2006 would become `grep bill
2007 /etc/passwd'.
2008 Aliases can be used to introduce parser metasyntax.
2009 For
2010 example,
2011 .Sq alias print
2012 pr \e!* | lpr'' defines a
2013 .Sq `command
2014 ' (`print') which
2015 .Va pr
2016 (1)s its arguments to the line printer.
2017 .Pp
2018 Alias substitution is repeated until the first word of the command has no
2019 alias.
2020 If an alias substitution does not change the first word (as in the
2021 previous example) it is flagged to prevent a loop.
2022 Other loops are detected and
2023 cause an error.
2024 .Pp
2025 Some aliases are referred to by the shell; see
2026 .Va Special aliases
2027 .Ss Variable substitution
2028 The shell maintains a list of variables, each of which has as value a list of
2029 zero or more words.
2030 The values of shell variables can be displayed and changed with the
2031 .Va set
2032 and
2033 .Va unset
2034 commands.
2035 The system maintains its own list of
2036 .Sq `environment
2037 ' variables.
2038 These can be displayed and changed with
2039 .Va printenv
2040 ,
2041 .Va setenv
2042 and
2043 .Va unsetenv
2044 .Pp
2045 (+) Variables may be made read-only with
2046 .Sq set \-r
2047 (q.v.).
2048 Read-only variables may not be modified or unset;
2049 attempting to do so will cause an error.
2050 Once made read-only, a variable cannot be made writable,
2051 so
2052 .Sq set \-r
2053 should be used with caution.
2054 Environment variables cannot be made read-only.
2055 .Pp
2056 Some variables are set by the shell or referred to by it.
2057 For instance, the
2058 .Va argv
2059 variable is an image of the shell's argument
2060 list, and words of this variable's value are referred to in special ways.
2061 Some of the variables referred to by the shell are toggles;
2062 the shell does not care what their value is, only whether they are set or not.
2063 For instance, the
2064 .Va verbose
2065 variable is a toggle which causes command
2066 input to be echoed.
2067 The
2068 .Fl v\fR command line option sets this variable.
2069 .Va Special shell variables
2070 lists all variables which are referred to by the shell.
2071 .Pp
2072 Other operations treat variables numerically.
2073 The
2074 .Sq @
2075 command permits numeric
2076 calculations to be performed and the result assigned to a variable.
2077 Variable
2078 values are, however, always represented as (zero or more) strings.
2079 For the
2080 purposes of numeric operations, the null string is considered to be zero, and
2081 the second and subsequent words of multi-word values are ignored.
2082 .Pp
2083 After the input line is aliased and parsed, and before each command is
2084 executed, variable substitution is performed keyed by
2085 .Sq $
2086 characters.
2087 This
2088 expansion can be prevented by preceding the
2089 .Sq $
2090 with a
2091 .Sq \e
2092 except within
2093 .Sq "
2094 s
2095 where it
2096 .Va always
2097 occurs, and within
2098 .Sq
2099 's where it
2100 .Va never
2101 occurs.
2102 Strings quoted by
2103 .Sq \`
2104 are interpreted later (see
2105 .Sx Command substitution
2106 below) so
2107 .Sq $
2108 substitution does not occur there until later,
2109 if at all.
2110 A
2111 .Sq $
2112 is passed unchanged if followed by a blank, tab, or
2113 end-of-line.
2114 .Pp
2115 Input/output redirections are recognized before variable expansion, and are
2116 variable expanded separately.
2117 Otherwise, the command name and entire argument
2118 list are expanded together.
2119 It is thus possible for the first (command) word
2120 (to this point) to generate more than one word, the first of which becomes the
2121 command name, and the rest of which become arguments.
2122 .Pp
2123 Unless enclosed in
2124 .Sq "
2125 or given the
2126 .Sq \&:q
2127 modifier the results of variable
2128 substitution may eventually be command and filename substituted.
2129 Within
2130 .Sq "
2131 , a
2132 variable whose value consists of multiple words expands to a (portion of a)
2133 single word, with the words of the variable's value separated by blanks.
2134 When
2135 the
2136 .Sq \&:q
2137 modifier is applied to a substitution the variable will expand to
2138 multiple words with each word separated by a blank and quoted to prevent later
2139 command or filename substitution.
2140 .Pp
2141 The following metasequences are provided for introducing variable values into
2142 the shell input.
2143 Except as noted, it is an error to reference a variable which
2144 is not set.
2145 .Pp
2146 .Bl -tag -width XXXXXXXXXX -offset indent -compact
2147 .PD 0
2148 .It Ar $name
2149 .It Ar ${name}
2150 Substitutes the words of the value of variable
2151 .Va name ,
2152 each separated
2153 by a blank.
2154 Braces insulate
2155 .Va name
2156 from following characters which would
2157 otherwise be part of it.
2158 Shell variables have names consisting of
2159 letters and digits starting with a letter.
2160 The underscore character is
2161 considered a letter.
2162 If
2163 .Va name
2164 is not a shell variable, but is set in the
2165 environment, then that value is returned (but some of the other forms
2166 given below are not available in this case).
2167 .It Ar $name[selector]
2168 .It Ar ${name[selector]}
2169 Substitutes only the selected words from the value of
2170 .Va name
2171 The
2172 .Va selector
2173 is subjected to
2174 .Sq $
2175 substitution and may consist of
2176 a single number or two numbers separated by a
2177 .Sq \&-
2178 The first word of a variable's value is numbered
2179 .Sq 1
2180 If the first number of a range is omitted it defaults to
2181 .Sq 1
2182 If the last member of a range is omitted it defaults to
2183 .Sq $#
2184 .Va name
2185 The
2186 .Va selector
2187 .Sq *
2188 selects all words.
2189 It is not an error for a range to be empty if the
2190 second argument is omitted or in range.
2191 .It Ar $0
2192 Substitutes the name of the file from which command input
2193 is being read.
2194 An error occurs if the name is not known.
2195 .It Ar $number
2196 .It Ar ${number}
2197 Equivalent to
2198 .Sq $argv[number]
2199 .It Ar $*
2200 Equivalent to
2201 .Sq $argv ,
2202 which is equivalent to
2203 .Sq $argv[*]
2204 .El
2205 .Pp
2206 The
2207 .Sq \&:
2208 modifiers described under
2209 .Sx History substitution ,
2210 except for
2211 .Sq \&:p ,
2212 can be applied to the substitutions above.
2213 More than one may be used.
2214 (+)
2215 Braces may be needed to insulate a variable substitution from a literal colon
2216 just as with
2217 .Sx History substitution
2218 (q.v.); any modifiers must appear
2219 within the braces.
2220 .Pp
2221 The following substitutions can not be modified with
2222 .Sq \&:
2223 modifiers.
2224 .Pp
2225 .Bl -tag -width XXXXXXXXXX -offset indent -compact
2226 .It Ar $?name
2227 .It Ar ${?name}
2228 Substitutes the string
2229 .Sq 1
2230 if
2231 .Va name
2232 is set,
2233 .Sq 0
2234 if it is not.
2235 .It Ar $?0
2236 Substitutes
2237 .Sq 1
2238 if the current input filename is known,
2239 .Sq 0
2240 if it is not.
2241 Always
2242 .Sq 0
2243 in interactive shells.
2244 .It Ar $#name
2245 .It Ar ${#name}
2246 Substitutes the number of words in
2247 .Va name
2248 .It Ar $#
2249 Equivalent to
2250 .Sq $#argv
2251 (+)
2252 .It Ar $%name
2253 .It Ar ${%name}
2254 Substitutes the number of characters in
2255 .Va name
2256 (+)
2257 .Pp
2258 .It Ar $%number
2259 .It Ar ${%number}
2260 Substitutes the number of characters in
2261 .Va $argv[number] .
2262 (+)
2263 .It Ar $?
2264 Equivalent to
2265 .Sq $status
2266 (+)
2267 .It Ar $$
2268 Substitutes the (decimal) process number of the (parent) shell.
2269 .It Ar $!
2270 Substitutes the (decimal) process number of the last
2271 background process started by this shell.
2272 (+)
2273 .It Ar $_
2274 Substitutes the command line of the last command executed.
2275 (+)
2276 .It Ar $<
2277 Substitutes a line from the standard input, with no further interpretation
2278 thereafter.
2279 It can be used to read from the keyboard in a shell script.
2280 (+) While
2281 .Xr csh 1
2282 always quotes $<, as if it were equivalent to
2283 .Sq $<:q ,
2284 .Nm
2285 does not.
2286 Furthermore, when
2287 .Nm
2288 is waiting for a line to be
2289 typed the user may type an interrupt to interrupt the sequence into
2290 which the line is to be substituted, but
2291 .Xr csh 1
2292 does not allow this.
2293 .El
2294 .Pp
2295 The editor command
2296 .Va expand-variables
2297 , normally bound to
2298 .Sq ^X-$ ,
2299 can be used to interactively expand individual variables.
2300 .Ss "Command, filename and directory stack substitution"
2301 The remaining substitutions are applied selectively to the arguments
2302 of builtin commands.
2303 This means that portions of expressions which are not evaluated are
2304 not subjected to these expansions.
2305 For commands which are not internal to the
2306 shell, the command name is substituted separately from the argument list.
2307 This occurs very late, after input-output redirection is performed, andk
2308 in a child of the main shell.
2309 .Ss "Command substitution"
2310 Command substitution is indicated by a command enclosed in
2311 .Sq \&`
2312 The output
2313 from such a command is broken into separate words at blanks, tabs and newlines,
2314 and null words are discarded.
2315 The output is variable and command substituted
2316 and put in place of the original string.
2317 .Pp
2318 Command substitutions inside double
2319 quotes
2320 .Sq ( \&" )
2321 retain blanks and tabs; only newlines force new words.
2322 The single
2323 final newline does not force a new word in any case.
2324 It is thus possible for a
2325 command substitution to yield only part of a word, even if the command outputs
2326 a complete line.
2327 .Pp
2328 By default, the shell since version 6.12 replaces all newline and carriage
2329 return characters in the command by spaces.
2330 If this is switched off by
2331 unsetting
2332 .Va csubstnonl ,
2333 newlines separate commands as usual.
2334 .Ss "Filename substitution"
2335 If a word contains any of the characters
2336 .Sq * ,
2337 .Sq \&? ,
2338 .Sq \&[
2339 or
2340 .Sq {
2341 or begins with
2342 the character
2343 .Sq ~
2344 it is a candidate for filename substitution, also known as
2345 .Dq globbing .
2346 This word is then regarded as a pattern
2347 .Dq ( glob-pattern ) ,
2348 and
2349 replaced with an alphabetically sorted list of file names which match the
2350 pattern.
2351 .Pp
2352 In matching filenames, the character
2353 .Sq .
2354 at the beginning of a filename or
2355 immediately following a
2356 .Sq / ,
2357 as well as the character
2358 .Sq /
2359 must be matched
2360 explicitly (unless either
2361 .Va globdot
2362 or
2363 .Va globstar
2364 or both are set(+)).
2365 The character
2366 .Sq *
2367 matches any string of characters,
2368 including the null string.
2369 The character
2370 .Sq \&?
2371 matches any single character.
2372 The sequence
2373 .Sq [...]
2374 matches any one of the characters enclosed.
2375 Within
2376 .Sq [...]
2377 , a pair of
2378 characters separated by
2379 .Sq \&-
2380 matches any character lexically between the two.
2381 .Pp
2382 (+) Some glob-patterns can be negated:
2383 The sequence
2384 .Sq [^...]
2385 matches any single character
2386 .Va not
2387 specified by the
2388 characters and/or ranges of characters in the braces.
2389 .Pp
2390 An entire glob-pattern can also be negated with
2391 .Sq ^ :
2392 .Bd -literal -offset indent
2393 > echo *
2394 bang crash crunch ouch
2395 > echo ^cr*
2396 bang ouch
2397 .Ed
2398 .Pp
2399 Glob-patterns which do not use
2400 .Sq \&? ,
2401 .Sq * , or
2402 .Sq []
2403 or which use
2404 .Sq {}
2405 or
2406 .Sq ~
2407 (below) are not negated correctly.
2408 .Pp
2409 The metanotation
2410 .Sq a{b,c,d}e
2411 is a shorthand for
2412 .Sq abe ace ade
2413 Left-to-right order is preserved:
2414 .Sq /usr/source/s1/{oldls,ls}.c
2415 expands
2416 to
2417 .Sq /usr/source/s1/oldls.c /usr/source/s1/ls.c
2418 The results of matches are
2419 sorted separately at a low level to preserve this order:
2420 .Sq ../{memo,*box}
2421 might expand to
2422 .Sq ../memo ../box ../mbox
2423 (Note that
2424 .Sq memo
2425 was not sorted with the results of matching
2426 .Sq *box . )
2427 It is not an error when this construct expands to files which do not exist,
2428 but it is possible to get an error from a command to which the expanded list
2429 is passed.
2430 This construct may be nested.
2431 As a special case the words
2432 .Sq { ,
2433 .Sq }
2434 and
2435 .Sq {}
2436 are passed undisturbed.
2437 .Pp
2438 The character
2439 .Sq ~
2440 at the beginning of a filename refers to home directories.
2441 Standing alone, i.e.,
2442 .Sq ~ ,
2443 it expands to the invoker's home directory as
2444 reflected in the value of the
2445 .Va home
2446 shell variable.
2447 When followed by a
2448 name consisting of letters, digits and
2449 .Sq \&-
2450 characters the shell searches for a
2451 user with that name and substitutes their home directory; thus
2452 .Sq ~ken
2453 might
2454 expand to
2455 .Sq /usr/ken
2456 and
2457 .Sq ~ken/chmach
2458 to
2459 .Sq /usr/ken/chmach
2460 If the character
2461 .Sq ~
2462 is followed by a character other than a letter or
2463 .Sq /
2464 or appears elsewhere
2465 than at the beginning of a word, it is left undisturbed.
2466 A command like
2467 .Sq setenv MANPATH /usr/man:/usr/local/man:~/lib/man
2468 does not,
2469 therefore, do home directory substitution as one might hope.
2470 .Pp
2471 It is an error for a glob-pattern containing
2472 .Sq * ,
2473 .Sq \&?  ,
2474 .Sq \&[
2475 or
2476 .Sq ~ ,
2477 with or
2478 without
2479 .Sq ^ ,
2480 not to match any files.
2481 However, only one pattern in a list of
2482 glob-patterns must match a file (so that, e.g.,
2483 .Sq rm *.a *.c *.o
2484 would fail
2485 only if there were no files in the current directory ending in
2486 .Sq .a ,
2487 .Sq .c ,
2488 or
2489 .Sq .o ) ,
2490 and if the
2491 .Va nonomatch
2492 shell variable is set a pattern (or list
2493 of patterns) which matches nothing is left unchanged rather than causing
2494 an error.
2495 .Pp
2496 The
2497 .Va globstar
2498 shell variable can be set to allow
2499 .Sq **
2500 or
2501 .Sq ***
2502 as
2503 a file glob pattern that matches any string of characters including
2504 .Sq / ,
2505 recursively traversing any existing sub-directories.
2506 For example,
2507 .Sq ls **.c
2508 will list all the .c files in the current directory tree.
2509 If used by itself, it will match zero or more sub-directories
2510 (e.g.
2511 .Sq ls /usr/include/**/time.h
2512 will list any file named
2513 .Sq time.h
2514 in the /usr/include directory tree;
2515 .Sq ls /usr/include/**time.h
2516 will match
2517 any file in the /usr/include directory tree ending in
2518 .Sq time.h ;
2519 and
2520 .Sq ls /usr/include/**time**.h
2521 will match any .h file with
2522 .Sq time
2523 either
2524 in a subdirectory name or in the filename itself).
2525 To prevent problems with recursion, the
2526 .Sq **
2527 glob-pattern will not
2528 descend into a symbolic link containing a directory.
2529 To override this,
2530 use
2531 .Sq ***
2532 (+)
2533 .Pp
2534 The
2535 .Va noglob
2536 shell variable can be set to prevent filename substitution,
2537 and the
2538 .Va expand-glob
2539 editor command, normally bound to
2540 .Sq ^X-* ,
2541 can be
2542 used to interactively expand individual filename substitutions.
2543 .Ss "Directory stack substitution (+)"
2544 The directory stack is a list of directories, numbered from zero, used by the
2545 .Va pushd ,
2546 .Va popd
2547 and
2548 .Va dirs
2549 builtin commands (q.v.).
2550 .Va dirs
2551 can print, store in a file, restore and clear the directory stack
2552 at any time, and the
2553 .Va savedirs
2554 and
2555 .Va dirsfile
2556 shell variables can be set to
2557 store the directory stack automatically on logout and restore it on login.
2558 The
2559 .Va dirstack
2560 shell variable can be examined to see the directory stack and
2561 set to put arbitrary directories into the directory stack.
2562 .Pp
2563 The character
2564 .Sq =
2565 followed by one or more digits expands to an entry in
2566 the directory stack.
2567 The special case
2568 .Sq =-
2569 expands to the last directory in
2570 the stack.
2571 For example,
2572 .Bd -literal -offset indent
2573 > dirs \&-v
2574 0       /usr/bin
2575 1       /usr/spool/uucp
2576 2       /usr/accts/sys
2577 > echo =1
2578 /usr/spool/uucp
2579 > echo =0/calendar
2580 /usr/bin/calendar
2581 > echo =\-
2582 /usr/accts/sys
2583 .Ed
2584 .Pp
2585 The
2586 .Va noglob
2587 and
2588 .Va nonomatch
2589 shell variables and the
2590 .Va expand-glob
2591 editor command apply to directory stack as well as filename substitutions.
2592 .Ss "Other substitutions (+)"
2593 There are several more transformations involving filenames, not strictly
2594 related to the above but mentioned here for completeness.
2595 .Va Any
2596 filename may be expanded to a full path when the
2597 .Va symlinks
2598 variable (q.v.) is set to
2599 .Sq expand
2600 Quoting prevents this expansion, and
2601 the
2602 .Va normalize-path
2603 editor command does it on demand.
2604 The
2605 .Va normalize-command
2606 editor command expands commands in PATH into
2607 full paths on demand.
2608 Finally,
2609 .Va cd
2610 and
2611 .Va pushd
2612 interpret
2613 .Sq \&-
2614 as the old working directory
2615 (equivalent to the shell variable
2616 .Va owd ) .
2617 This is not a substitution at all, but an abbreviation recognized by only
2618 those commands.
2619 Nonetheless, it too can be prevented by quoting.
2620 .Ss "Commands"
2621 The next three sections describe how the shell executes commands and
2622 deals with their input and output.
2623 .Ss "Simple commands, pipelines and sequences"
2624 A simple command is a sequence of words, the first of which specifies the
2625 command to be executed.
2626 A series of simple commands joined by
2627 .Sq |
2628 characters
2629 forms a pipeline.
2630 The output of each command in a pipeline is connected to the
2631 input of the next.
2632 .Pp
2633 Simple commands and pipelines may be joined into sequences with
2634 .Sq ; ,
2635 and will
2636 be executed sequentially.
2637 Commands and pipelines can also be joined into
2638 sequences with
2639 .Sq ||
2640 or
2641 .Sq && ,
2642 indicating, as in the C language, that the second
2643 is to be executed only if the first fails or succeeds respectively.
2644 .Pp
2645 A simple command, pipeline or sequence may be placed in parentheses,
2646 .Sq () ,
2647 to form a simple command, which may in turn be a component of a pipeline or
2648 sequence.
2649 A command, pipeline or sequence can be executed
2650 without waiting for it to terminate by following it with an
2651 .Sq \&& .
2652 .Ss "Builtin and non-builtin command execution"
2653 Builtin commands are executed within the shell.
2654 If any component of a
2655 pipeline except the last is a builtin command, the pipeline is executed
2656 in a subshell.
2657 .Pp
2658 Parenthesized commands are always executed in a subshell.
2659 .Bd -literal -offset indent
2660 (cd; pwd); pwd
2661 .Ed
2662 .Pp
2663 thus prints the
2664 .Va home
2665 directory, leaving you where you were
2666 (printing this after the home directory), while
2667 .Bd -literal -offset indent
2668 cd; pwd
2669 .Ed
2670 .Pp
2671 leaves you in the
2672 .Va home
2673 directory.
2674 Parenthesized commands are most often
2675 used to prevent
2676 .Va cd
2677 from affecting the current shell.
2678 .Pp
2679 When a command to be executed is found not to be a builtin command the shell
2680 attempts to execute the command via
2681 .Xr execve 2 .
2682 Each word in the variable
2683 .Va path
2684 names a directory in which the shell will look for the
2685 command.
2686 If the shell is not given a
2687 .Fl f
2688 option, the shell
2689 hashes the names in these directories into an internal table so that it will
2690 try an
2691 .Xr execve 2
2692 in only a directory where there is a possibility that the
2693 command resides there.
2694 This greatly speeds command location when a large
2695 number of directories are present in the search path. This hashing mechanism is
2696 not used:
2697 .TP 4
2698 .Bl -enum -width indent
2699 .It
2700 If hashing is turned explicitly off via
2701 .Va unhash
2702 .It
2703 If the shell was given a
2704 .Fl f Ar argument
2705 .It 
2706 For each directory component of
2707 .Va path
2708 which does not begin with a
2709 .Sq /
2710 .It
2711 If the command contains a
2712 .Sq /
2713 .El
2714 .Pp
2715 In the above four cases the shell concatenates each component of the path
2716 vector with the given command name to form a path name of a file which it
2717 then attempts to execute it. If execution is successful, the search stops.
2718 .Pp
2719 If the file has execute permissions but is not an executable to the system
2720 (i.e., it is neither an executable binary nor a script that specifies its
2721 interpreter), then it is assumed to be a file containing shell commands and
2722 a new shell is spawned to read it.
2723 The
2724 .Va shell
2725 special alias may be set
2726 to specify an interpreter other than the shell itself.
2727 .Pp
2728 On systems which do not understand the
2729 .Sq #!
2730 script interpreter convention
2731 the shell may be compiled to emulate it; see the
2732 .Va version
2733 shell
2734 variable.
2735 If so, the shell checks the first line of the file to
2736 see if it is of the form
2737 .Sq #!interpreter arg ...
2738 If it is,
2739 the shell starts
2740 .Va interpreter
2741 with the given
2742 .Va arg
2743 s and feeds the
2744 file to it on standard input.
2745 .Ss "Input/output"
2746 The standard input and standard output of a command may be redirected with the
2747 following syntax:
2748 .Pp
2749 .Bl -tag -width XXXXXXXXX -offset indent -compact
2750 .It Ar < name
2751 Open file
2752 .Va name
2753 (which is first variable, command and filename
2754 expanded) as the standard input.
2755 .It Ar << word
2756 Read the shell input up to a line which is identical to
2757 .Va word .
2758 .Va word
2759 is not subjected to variable, filename or command substitution, and each input
2760 line is compared to
2761 .Va word
2762 before any substitutions are done on this input
2763 line.
2764 Unless a quoting
2765 .Sq \e ,
2766 .Sq \&"
2767 ,
2768 .Sq \&'
2769 or
2770 .Sq \&`
2771 appears in
2772 .Va word
2773 variable and
2774 command substitution is performed on the intervening lines, allowing
2775 .Sq \e
2776 to
2777 quote
2778 .Sq $ ,
2779 .Sq \e
2780 and
2781 .Sq \&` .
2782 Commands which are substituted have all blanks, tabs,
2783 and newlines preserved, except for the final newline which is dropped.
2784 The
2785 resultant text is placed in an anonymous temporary file which is given to the
2786 command as standard input.
2787 .Pp
2788 .It Ar > name
2789 .It Ar >! name
2790 .It Ar >& name
2791 .It Ar >&! name
2792 The file
2793 .Va name
2794 is used as standard output.
2795 If the file does not exist
2796 then it is created; if the file exists, it is truncated, its previous contents
2797 being lost.
2798 .Pp
2799 If the shell variable
2800 .Va noclobber
2801 is set, then the file must not exist or be a
2802 character special file (e.g., a terminal or
2803 .Sq /dev/null )
2804 or an error results.
2805 This helps prevent accidental destruction of files.
2806 In this case the
2807 .Sq \&!
2808 forms
2809 can be used to suppress this check.
2810 If
2811 .Va notempty
2812 is given in
2813 .Va noclobber ,
2814 .Sq >
2815 is allowed on empty files;
2816 if
2817 .Va ask
2818 is set, an interacive confirmation is presented, rather than an
2819 error.
2820 .Pp
2821 The forms involving
2822 .Sq \&&
2823 route the diagnostic output into the specified file as
2824 well as the standard output.
2825 .Va name
2826 is expanded in the same way as
2827 .Sq <
2828 input filenames are.
2829 .Pp
2830 .It Ar >> name
2831 .It Ar >>& name
2832 .It Ar >>! name
2833 .It Ar >>&! name
2834 Like
2835 .Sq >
2836 , but appends output to the end of
2837 .Va name
2838 If the shell variable
2839 .Va noclobber
2840 is set, then it is an error for
2841 the file
2842 .Va not
2843 to exist, unless one of the
2844 .Sq \&!
2845 forms is given.
2846 .El
2847 .Pp
2848 A command receives the environment in which the shell was invoked as modified
2849 by the input-output parameters and the presence of the command in a pipeline.
2850 Thus, unlike some previous shells, commands run from a file of shell commands
2851 have no access to the text of the commands by default; rather they receive the
2852 original standard input of the shell.
2853 The
2854 .Sq <<
2855 mechanism should be used to
2856 present inline data.
2857 This permits shell command scripts to function as
2858 components of pipelines and allows the shell to block read its input.
2859 Note
2860 that the default standard input for a command run detached is
2861 .Va not
2862 the empty file
2863 .Va /dev/null ,
2864 but the original standard input of the shell.
2865 If this is a terminal and if the process attempts to read from the terminal,
2866 then the process will block and the user will be notified (see
2867 .Sx Jobs ) .
2868 .Pp
2869 Diagnostic output may be directed through a pipe with the standard output.
2870 Simply use the form
2871 .Sq |&
2872 rather than just
2873 .Sq | .
2874 .Pp
2875 The shell cannot presently redirect diagnostic output without also redirecting
2876 standard output, but
2877 .Sq \&( command > output-file ) >&  error-file
2878 is often an acceptable workaround.
2879 Either
2880 .Va output-file
2881 or
2882 .Va error-file
2883 may be
2884 .Sq /dev/tty
2885 to send output to the terminal.
2886 .Ss "Features"
2887 Having described how the shell accepts, parses and executes
2888 command lines, we now turn to a variety of its useful features.
2889 .Ss "Control flow"
2890 The shell contains a number of commands which can be used to regulate the
2891 flow of control in command files (shell scripts) and (in limited but
2892 useful ways) from terminal input.
2893 These commands all operate by forcing the
2894 shell to reread or skip in its input and, due to the implementation,
2895 restrict the placement of some of the commands.
2896 .Pp
2897 The
2898 .Va foreach ,
2899 .Va switch ,
2900 and
2901 .Va while
2902 statements, as well as the
2903 .Va if-then-else
2904 form of the
2905 .Va if
2906 statement, require that the major
2907 keywords appear in a single simple command on an input line as shown below.
2908 .Pp
2909 If the shell's input is not seekable, the shell buffers up input whenever
2910 a loop is being read and performs seeks in this internal buffer to
2911 accomplish the rereading implied by the loop.
2912 (To the extent that this allows, backward
2913 .Va goto
2914 s will succeed on non-seekable inputs.)
2915 .Ss "Expressions"
2916 The
2917 .Va if ,
2918 .Va while
2919 and
2920 .Va exit
2921 builtin commands
2922 use expressions with a common syntax.
2923 The expressions can include any
2924 of the operators described in the next three sections.
2925 Note that the
2926 .Va @
2927 builtin command (q.v.) has its own separate syntax.
2928 .Ss "Logical, arithmetical and comparison operators"
2929 These operators are similar to those of C and have the same precedence.
2930 They include
2931 .IP "" 4
2932 .Bl -tag -width XXXXXX -offset indent -compact
2933 .It ||  &&  |   &  ==  !=  =~  !~  <=  >=
2934 .It <  > <<  >>  +  \-  *  /  %  !  ~  (  )
2935 .El
2936 .Pp
2937 Here the precedence increases to the right,
2938 .Sq ==
2939 .Sq \&!=
2940 .Sq =~
2941 and
2942 .Sq \&!~ ,
2943 .Sq <=
2944 .Sq >=
2945 .Sq <
2946 and
2947 .Sq > ,
2948 .Sq <<
2949 .Sq >> ,
2950 .Sq +
2951 and
2952 .Sq \&- ,
2953 .Sq *
2954 .Sq /
2955 and
2956 .Sq %
2957 being, in
2958 groups, at the same level.
2959 The
2960 .Sq ==
2961 .Sq \&!=
2962 .Sq =~
2963 and
2964 .Sq \&!~
2965 operators compare
2966 their arguments as strings; all others operate on numbers.
2967 The operators
2968 .Sq =~
2969 and
2970 .Sq \&!~
2971 are like
2972 .Sq \&!=
2973 and
2974 .Sq ==
2975 except that the right hand side is a
2976 glob-pattern (see
2977 .Sx Filename substitution )
2978 against which the left hand operand is matched.
2979 This reduces the need for use of the
2980 .Va switch
2981 builtin command in shell scripts when all that is really needed is
2982 pattern matching.
2983 .Pp
2984 Null or
2985 missing arguments are considered
2986 .Sq 0
2987 The results of all expressions are
2988 strings, which represent decimal numbers.
2989 It is important to note that
2990 no two components of an expression can appear in the same word; except
2991 when adjacent to components of expressions which are syntactically
2992 significant to the parser
2993 .Sq ( \&&
2994 .Sq |
2995 .Sq <
2996 .Sq >
2997 .Sq \&(
2998 .Sq \&) )
2999 they should be
3000 surrounded by spaces.
3001 .Ss "Command exit status"
3002 Commands can be executed in expressions and their exit status
3003 returned by enclosing them in braces 
3004 .Sq ( {} ) .
3005 Remember that the braces should
3006 be separated from the words of the command by spaces.
3007 Command executions
3008 succeed, returning true, i.e.,
3009 .Sq 1 ,
3010 if the command exits with status 0,
3011 otherwise they fail, returning false, i.e.,
3012 .Sq 0 .
3013 If more detailed status
3014 information is required then the command should be executed outside of an
3015 expression and the
3016 .Va status
3017 shell variable examined.
3018 .Ss "File inquiry operators"
3019 Some of these operators perform true/false tests on files and related
3020 objects.
3021 They are of the form
3022 .Fl
3023 .Va op file
3024 , where
3025 .Va op
3026 is one of
3027 .Bl -tag -width XXX -offset indent -compact
3028 .It Ar r
3029 Read access
3030 .It Ar w
3031 Write access
3032 .It Ar x
3033 Execute access
3034 .It Ar X
3035 Executable in the path or shell builtin, e.g.,
3036 .Sq \&-X ls
3037 and
3038 .Sq \&-X ls\&-F
3039 are
3040 generally true, but
3041 .Sq \&-X /bin/ls
3042 is not (+)
3043 .It Ar e
3044 Existence
3045 .It Ar o
3046 Ownership
3047 .It Ar z
3048 Zero size
3049 .It Ar s
3050 Non-zero size (+)
3051 .It Ar f
3052 Plain file
3053 .It Ar d
3054 Directory
3055 .It Ar l
3056 Symbolic link (+) *
3057 .It Ar b
3058 Block special file (+)
3059 .It Ar c
3060 Character special file (+)
3061 .It Ar p
3062 Named pipe (fifo) (+) *
3063 .It Ar S
3064 Socket special file (+) *
3065 .It Ar u
3066 Set-user-ID bit is set (+)
3067 .It Ar g
3068 Set-group-ID bit is set (+)
3069 .It Ar k
3070 Sticky bit is set (+)
3071 .It Ar t file
3072 (which must be a digit) is an open file descriptor
3073 for a terminal device (+)
3074 .It Ar R
3075 Has been migrated (Convex only) (+)
3076 .It Ar L
3077 Applies subsequent operators in a multiple-operator test to a symbolic link
3078 rather than to the file to which the link points (+) *
3079 .El
3080 .Pp
3081 .Va file
3082 is command and filename expanded and then tested to
3083 see if it has the specified relationship to the real user.
3084 If
3085 .Va file
3086 does not exist or is inaccessible or, for the operators indicated by
3087 .Sq * ,
3088 if the specified file type does not exist on the current system,
3089 then all inquiries return false, i.e.,
3090 .Sq 0 .
3091 .Pp
3092 These operators may be combined for conciseness:
3093 .Sq \&-
3094 .Va xy file
3095 is
3096 equivalent to
3097 .Sq \&-x file && \&-y file .
3098 (+) For example,
3099 .Sq \&-fx
3100 is true
3101 (returns
3102 .Sq 1 )
3103 for plain executable files, but not for directories.
3104 .Pp
3105 .Va L
3106 may be used in a multiple-operator test to apply subsequent operators
3107 to a symbolic link rather than to the file to which the link points.
3108 For example,
3109 .Sq \&-lLo
3110 is true for links owned by the invoking user.
3111 .Va Lr ,
3112 .Va Lw
3113 and
3114 .Va Lx
3115 are always true for links and false for
3116 non-links.
3117 .Va L
3118 has a different meaning when it is the last operator
3119 in a multiple-operator test; see below.
3120 .Pp
3121 It is possible but not useful, and sometimes misleading, to combine operators
3122 which expect
3123 .Va file
3124 to be a file with operators which do not
3125 (e.g.,
3126 .Va X
3127 and
3128 .Va t ) .
3129 Following
3130 .Va L
3131 with a non-file operator
3132 can lead to particularly strange results.
3133 .Pp
3134 Other operators return other information, i.e., not just
3135 .Sq 0
3136 or
3137 .Sq 1
3138 (+)
3139 They have the same format as before;
3140 .Va op
3141 may be one of
3142 .Pp
3143 .Bl -tag -width XXX -offset indent -compact
3144 .It Ar A
3145 Last file access time, as the number of seconds since the epoch
3146 .It Ar A:
3147 Like
3148 .Va Ar A
3149 , but in timestamp format, e.g.,
3150 .Sq Fri May 14 16:36:10 1993
3151 .It Ar M
3152 Last file modification time
3153 .It Ar M:
3154 Like
3155 .Va M
3156 , but in timestamp format
3157 .It Ar C
3158 Last inode modification time
3159 .It Ar C:
3160 Like
3161 .Va C
3162 , but in timestamp format
3163 .It Ar D
3164 Device number
3165 .It Ar I
3166 Inode number
3167 .It Ar F
3168 Composite
3169 .Va f
3170 ile identifier, in the form
3171 .Va device :
3172 .Va inode
3173 .It Ar L
3174 The name of the file pointed to by a symbolic link
3175 .It Ar N
3176 Number of (hard) links
3177 .It Ar P
3178 Permissions, in octal, without leading zero
3179 .It Ar P:
3180 Like
3181 .Va P
3182 , with leading zero
3183 .It Ar P<mode>
3184 Equivalent to
3185 .Sq \-P
3186 .Va file
3187 &
3188 .Va mode
3189 , e.g.,
3190 .Sq \-P22
3191 .Va file
3192 returns
3193 `22' if
3194 .Va file
3195 is writable by group and other,
3196 .Sq 20
3197 if by group only,
3198 and
3199 .Sq 0
3200 if by neither
3201 .It Ar P<mode>:
3202 Like 
3203 .Ar BP
3204 .Va mode
3205 , with leading zero
3206 .It Ar U
3207 Numeric userid
3208 .It Ar U:
3209 Username, or the numeric userid if the username is unknown
3210 .It Ar G
3211 Numeric groupid
3212 .It Ar G:
3213 Groupname, or the numeric groupid if the groupname is unknown
3214 .It Ar Z
3215 Size, in bytes
3216 .El
3217 .Pp
3218 Only one of these operators may appear in a multiple-operator test, and it
3219 must be the last.
3220 Note that
3221 .Va L
3222 has a different meaning at the end of and
3223 elsewhere in a multiple-operator test.
3224 Because
3225 .Sq 0
3226 is a valid return value
3227 for many of these operators, they do not return
3228 .Sq 0
3229 when they fail: most
3230 return
3231 .Sq \&-1
3232 , and
3233 .Va F
3234 returns
3235 .Sq \&:
3236 .Pp
3237 If the shell is compiled with POSIX defined (see the
3238 .Va version
3239 shell
3240 variable), the result of a file inquiry is based on the permission bits of
3241 the file and not on the result of the
3242 .Va access
3243 (2) system call.
3244 For example, if one tests a file with
3245 .Fl w\fR whose permissions would
3246 ordinarily allow writing but which is on a file system mounted read-only,
3247 the test will succeed in a POSIX shell but fail in a non-POSIX shell.
3248 .Pp
3249 File inquiry operators can also be evaluated with the
3250 .Va filetest
3251 builtin
3252 command (q.v.) (+).
3253 .Ss Jobs
3254 The shell associates a
3255 .Va job
3256 with each pipeline.
3257 It keeps a table of
3258 current jobs, printed by the
3259 .Va jobs
3260 command, and assigns them small integer
3261 numbers.
3262 When a job is started asynchronously with
3263 .Sq &
3264 , the shell prints a
3265 line which looks like
3266 .IP "" 4
3267 [1] 1234
3268 .Pp
3269 indicating that the job which was started asynchronously was job number 1 and
3270 had one (top-level) process, whose process id was 1234.
3271 .Pp
3272 If you are running a job and wish to do something else you may hit the suspend
3273 key (usually
3274 .Sq ^Z ) ,
3275 which sends a STOP signal to the current job.
3276 The shell will then normally
3277 indicate that the job has been
3278 .Sq Suspended
3279 and print another prompt.
3280 If the
3281 .Va listjobs
3282 shell variable is set, all jobs will be listed
3283 like the
3284 .Va jobs
3285 builtin command; if it is set to
3286 .Sq long
3287 the listing will
3288 be in long format, like
3289 .Sq jobs \&-l
3290 You can then manipulate the state of the suspended job.
3291 You can put it in the
3292 .Dq background
3293  with the
3294 .Va bg
3295 command or run some other commands and
3296 eventually bring the job back into the
3297 .Sq foreground
3298 ' with
3299 .Va fg
3300 (See also the
3301 .Va run-fg-editor
3302 editor command.)
3303 A
3304 .Sq ^Z
3305 takes effect immediately and is like an interrupt
3306 in that pending output and unread input are discarded when it is typed.
3307 The
3308 .Va wait
3309 builtin command causes the shell to wait for all background
3310 jobs to complete.
3311 .Pp
3312 The
3313 .Sq ^]
3314 key sends a delayed suspend signal, which does not generate a STOP
3315 signal until a program attempts to
3316 .Va read
3317 (2) it, to the current job.
3318 This can usefully be typed ahead when you have prepared some commands for a
3319 job which you wish to stop after it has read them.
3320 The
3321 .Sq ^Y
3322 key performs this function in
3323 .Xr csh 1
3324 ; in
3325 .Nm
3326 ,
3327 `^Y' is an editing command.
3328 (+)
3329 .Pp
3330 A job being run in the background stops if it tries to read from the
3331 terminal.
3332 Background jobs are normally allowed to produce output, but this can
3333 be disabled by giving the command
3334 .Sq stty tostop
3335 If you set this tty option,
3336 then background jobs will stop when they try to produce output like they do
3337 when they try to read input.
3338 .Pp
3339 There are several ways to refer to jobs in the shell.
3340 The character
3341 .Sq %
3342 introduces a job name.
3343 If you wish to refer to job number 1, you can name it
3344 as
3345 .Sq %1
3346 Just naming a job brings it to the foreground; thus
3347 .Sq %1
3348 is a synonym
3349 for
3350 .Sq fg %1
3351 , bringing job 1 back into the foreground.
3352 Similarly, saying
3353 .Sq %1 &
3354 resumes job 1 in the background, just like
3355 .Sq bg %1
3356 A job can also be named
3357 by an unambiguous prefix of the string typed in to start it:
3358 .Sq %ex
3359 would
3360 normally restart a suspended
3361 .Va ex
3362 (1) job, if there were only one suspended
3363 job whose name began with the string
3364 .Sq ex
3365 It is also possible to say
3366 `%?
3367 .Va string
3368 ' to specify a job whose text contains
3369 .Va string
3370 , if there
3371 is only one such job.
3372 .Pp
3373 The shell maintains a notion of the current and previous jobs.
3374 In output
3375 pertaining to jobs, the current job is marked with a
3376 .Sq +
3377 and the previous job
3378 with a
3379 .Sq \-
3380 The abbreviations
3381 .Sq %+
3382 ,
3383 .Sq %
3384 , and (by analogy with the syntax of
3385 the
3386 .Va history
3387 mechanism)
3388 .Sq %%
3389 all refer to the current job, and
3390 .Sq %\-
3391 refers
3392 to the previous job.
3393 .Pp
3394 The job control mechanism requires that the
3395 .Va stty
3396 (1) option
3397 .Sq new
3398 be set
3399 on some systems.
3400 It is an artifact from a
3401 .Sq new
3402 implementation of the tty
3403 driver which allows generation of interrupt characters from the keyboard to
3404 tell jobs to stop.
3405 See
3406 .Va stty
3407 (1) and the
3408 .Va setty
3409 builtin command for
3410 details on setting options in the new tty driver.
3411 .Ss "Status reporting"
3412 The shell learns immediately whenever a process changes state.
3413 It normally
3414 informs you whenever a job becomes blocked so that no further progress is
3415 possible, but only right before it prints a prompt.
3416 This is done so that it
3417 does not otherwise disturb your work.
3418 If, however, you set the shell variable
3419 .Va notify
3420 , the shell will notify you immediately of changes of status in
3421 background jobs.
3422 There is also a shell command
3423 .Va notify
3424 which marks a
3425 single process so that its status changes will be immediately reported.
3426 By
3427 default
3428 .Va notify
3429 marks the current process; simply say
3430 .Sq notify
3431 after
3432 starting a background job to mark it.
3433 .Pp
3434 When you try to leave the shell while jobs are stopped, you will be
3435 warned that
3436 .Sq There are suspended jobs.
3437 You may use the
3438 .Va jobs
3439 command to
3440 see what they are.
3441 If you do this or immediately try to exit again, the shell
3442 will not warn you a second time, and the suspended jobs will be terminated.
3443 .Ss "Automatic, periodic and timed events (+)"
3444 There are various ways to run commands and take other actions automatically
3445 at various times in the
3446 .Sq `life cycle
3447 ' of the shell.
3448 They are summarized here,
3449 and described in detail under the appropriate
3450 .Va Builtin commands
3451 ,
3452 .Va Special shell variables
3453 and
3454 .Va Special aliases
3455 .Pp
3456 The
3457 .Va sched
3458 builtin command puts commands in a scheduled-event list,
3459 to be executed by the shell at a given time.
3460 .Pp
3461 The
3462 .Va beepcmd
3463 ,
3464 .Va cwdcmd
3465 ,
3466 .Va periodic
3467 ,
3468 .Va precmd
3469 ,
3470 .Va postcmd
3471 ,
3472 and
3473 .Va jobcmd
3474 .Va Special aliases
3475 can be set, respectively, to execute commands when the shell wants
3476 to ring the bell, when the working directory changes, every
3477 .Va tperiod
3478 minutes, before each prompt, before each command gets executed, after each
3479 command gets executed, and when a job is started or is brought into the
3480 foreground.
3481 .Pp
3482 The
3483 .Va autologout
3484 shell variable can be set to log out or lock the shell
3485 after a given number of minutes of inactivity.
3486 .Pp
3487 The
3488 .Va mail
3489 shell variable can be set to check for new mail periodically.
3490 .Pp
3491 The
3492 .Va printexitvalue
3493 shell variable can be set to print the exit status
3494 of commands which exit with a status other than zero.
3495 .Pp
3496 The
3497 .Va rmstar
3498 shell variable can be set to ask the user, when
3499 .Sq rm *
3500 is
3501 typed, if that is really what was meant.
3502 .Pp
3503 The
3504 .Va time
3505 shell variable can be set to execute the
3506 .Va time
3507 builtin
3508 command after the completion of any process that takes more than a given
3509 number of CPU seconds.
3510 .Pp
3511 The
3512 .Va watch
3513 and
3514 .Va who
3515 shell variables can be set to report when
3516 selected users log in or out, and the
3517 .Va log
3518 builtin command reports
3519 on those users at any time.
3520 .Ss "Native Language System support (+)"
3521 The shell is eight bit clean
3522 (if so compiled; see the
3523 .Va version
3524 shell variable)
3525 and thus supports character sets needing this capability.
3526 NLS support differs depending on whether or not
3527 the shell was compiled to use the system's NLS (again, see
3528 .Va version
3529 ).
3530 In either case, 7-bit ASCII is the default character code
3531 (e.g., the classification of which characters are printable) and sorting,
3532 and changing the
3533 .Va LANG
3534 or
3535 .Va LC_CTYPE
3536 environment variables
3537 causes a check for possible changes in these respects.
3538 .Pp
3539 When using the system's NLS, the
3540 .Va setlocale
3541 (3) function is called
3542 to determine appropriate character code/classification and sorting
3543 (e.g., a 'en_CA.UTF-8' would yield "UTF-8" as a character code).
3544 This function typically examines the
3545 .Va LANG
3546 and
3547 .Va LC_CTYPE
3548 environment variables; refer to the system documentation for further details.
3549 When not using the system's NLS, the shell simulates it by assuming that the
3550 ISO 8859-1 character set is used
3551 whenever either of the
3552 .Va LANG
3553 and
3554 .Va LC_CTYPE
3555 variables are set, regardless of
3556 their values.
3557 Sorting is not affected for the simulated NLS.
3558 .Pp
3559 In addition, with both real and simulated NLS, all printable
3560 characters in the range \e200\-\e377, i.e., those that have
3561 M-
3562 .Va char
3563 bindings, are automatically rebound to
3564 .Va self-insert-command
3565 The corresponding binding for the escape-
3566 .Va char
3567 sequence, if any, is
3568 left alone.
3569 These characters are not rebound if the
3570 .Va NOREBIND
3571 environment variable
3572 is set.
3573 This may be useful for the simulated NLS or a primitive real NLS
3574 which assumes full ISO 8859-1.
3575 Otherwise, all M-
3576 .Va char
3577 bindings in the
3578 range \e240\-\e377 are effectively undone.
3579 Explicitly rebinding the relevant keys with
3580 .Va bindkey
3581 is of course still possible.
3582 .Pp
3583 Unknown characters (i.e., those that are neither printable nor control
3584 characters) are printed in the format \ennn.
3585 If the tty is not in 8 bit mode, other 8 bit characters are printed by
3586 converting them to ASCII and using standout mode.
3587 The shell
3588 never changes the 7/8 bit mode of the tty and tracks user-initiated
3589 changes of 7/8 bit mode.
3590 NLS users (or, for that matter, those who want to
3591 use a meta key) may need to explicitly set
3592 the tty in 8 bit mode through the appropriate
3593 .Va stty
3594 (1)
3595 command in, e.g., the
3596 .Va ~/.login
3597 file.
3598 .Ss "OS variant support (+)"
3599 A number of new builtin commands are provided to support features in
3600 particular operating systems.
3601 All are described in detail in the
3602 .Va Builtin commands
3603 section.
3604 .Pp
3605 On systems that support TCF (aix-ibm370, aix-ps2),
3606 .Va getspath
3607 and
3608 .Va setspath
3609 get and set the system execution path,
3610 .Va getxvers
3611 and
3612 .Va setxvers
3613 get and set the experimental version prefix
3614 and
3615 .Va migrate
3616 migrates processes between sites.
3617 The
3618 .Va jobs
3619 builtin
3620 prints the site on which each job is executing.
3621 .Pp
3622 Under BS2000,
3623 .Va bs2cmd
3624 executes commands of the underlying BS2000/OSD
3625 operating system.
3626 .Pp
3627 Under Domain/OS,
3628 .Va inlib
3629 adds shared libraries to the current environment,
3630 .Va rootnode
3631 changes the rootnode and
3632 .Va ver
3633 changes the systype.
3634 .Pp
3635 Under Mach,
3636 .Va setpath
3637 is equivalent to Mach's
3638 .Va setpath
3639 (1).
3640 .Pp
3641 Under Masscomp/RTU and Harris CX/UX,
3642 .Va universe
3643 sets the universe.
3644 .Pp
3645 Under Harris CX/UX,
3646 .Va ucb
3647 or
3648 .Va att
3649 runs a command under the specified
3650 universe.
3651 .Pp
3652 Under Convex/OS,
3653 .Va warp
3654 prints or sets the universe.
3655 .Pp
3656 The
3657 .Va VENDOR
3658 ,
3659 .Va OSTYPE
3660 and
3661 .Va MACHTYPE
3662 environment variables
3663 indicate respectively the vendor, operating system and machine type
3664 (microprocessor class or machine model) of the
3665 system on which the shell thinks it is running.
3666 These are particularly useful when sharing one's home directory between several
3667 types of machines; one can, for example,
3668 .IP "" 4
3669 set path = (~/bin.$MACHTYPE /usr/ucb /bin /usr/bin .)
3670 .Pp
3671 in one's
3672 .Va ~/.login
3673 and put executables compiled for each machine in the
3674 appropriate directory.
3675 .Pp
3676 The
3677 .Va version
3678 shell
3679 variable indicates what options were chosen when the shell was compiled.
3680 .Pp
3681 Note also the
3682 .Va newgrp
3683 builtin, the
3684 .Va afsuser
3685 and
3686 .Va echo_style
3687 shell variables and the system-dependent locations of
3688 the shell's input files (see
3689 .Va FILES
3690 ).
3691 .Ss "Signal handling"
3692 Login shells ignore interrupts when reading the file
3693 .Va ~/.logout
3694 The shell ignores quit signals unless started with
3695 .Fl q\fR.
3696 Login shells catch the terminate signal, but non-login shells inherit the
3697 terminate behavior from their parents.
3698 Other signals have the values which the shell inherited from its parent.
3699 .Pp
3700 In shell scripts, the shell's handling of interrupt and terminate signals
3701 can be controlled with
3702 .Va onintr
3703 , and its handling of hangups can be
3704 controlled with
3705 .Va hup
3706 and
3707 .Va nohup
3708 .Pp
3709 The shell exits on a hangup (see also the
3710 .Va logout
3711 shell variable).
3712 By
3713 default, the shell's children do too, but the shell does not send them a
3714 hangup when it exits.
3715 .Va hup
3716 arranges for the shell to send a hangup to
3717 a child when it exits, and
3718 .Va nohup
3719 sets a child to ignore hangups.
3720 .Ss "Terminal management (+)"
3721 The shell uses three different sets of terminal (
3722 .Dq tty
3723 ) modes:
3724 `edit', used when editing,
3725 .Sq quote
3726 , used when quoting literal characters,
3727 and
3728 .Sq execute
3729 , used when executing commands.
3730 The shell holds some settings in each mode constant, so commands which leave
3731 the tty in a confused state do not interfere with the shell.
3732 The shell also matches changes in the speed and padding of the tty.
3733 The list of tty modes that are kept constant
3734 can be examined and modified with the
3735 .Va setty
3736 builtin.
3737 Note that although the editor uses CBREAK mode (or its equivalent),
3738 it takes typed-ahead characters anyway.
3739 .Pp
3740 The
3741 .Va echotc
3742 ,
3743 .Va settc
3744 and
3745 .Va telltc
3746 commands can be used to
3747 manipulate and debug terminal capabilities from the command line.
3748 .Pp
3749 On systems that support SIGWINCH or SIGWINDOW, the shell
3750 adapts to window resizing automatically and adjusts the environment
3751 variables
3752 .Va LINES
3753 and
3754 .Va COLUMNS
3755 if set.
3756 If the environment
3757 variable
3758 .Va TERMCAP
3759 contains li# and co# fields, the shell adjusts
3760 them to reflect the new window size.
3761 .Sh REFERENCE
3762 The next sections of this manual describe all of the available
3763 .Va Builtin commands
3764 ,
3765 .Va Special aliases
3766 and
3767 .Va Special shell variables
3768 .Ss "Builtin commands"
3769 .Bl -tag -width XXXXXXX -offset indent
3770 .It Ar %job
3771 A synonym for the
3772 .Va fg
3773 builtin command.
3774 .It Ar %job \&&
3775 A synonym for the
3776 .Va bg
3777 builtin command.
3778 .It Ar \&:
3779 Does nothing, successfully.
3780 .Pp
3781 .It Ar @
3782 .It Ar @ name = expr
3783 .It Ar @ name[index] = expr
3784 .It Ar @ name++|--
3785 .It Ar @name[index]++|--
3786 The first form prints the values of all shell variables.
3787 .Pp
3788 The second form assigns the value of
3789 .Va expr
3790 to
3791 .Va name
3792 The third form assigns the value of
3793 .Va expr
3794 to the
3795 .Va index
3796 'th
3797 component of
3798 .Va name
3799 ; both
3800 .Va name
3801 and its
3802 .Va index
3803 'th component
3804 must already exist.
3805 .Pp
3806 .Va expr
3807 may contain the operators
3808 .Sq *
3809 ,
3810 .Sq +
3811 , etc., as in C.
3812 If
3813 .Va expr
3814 contains
3815 .Sq <
3816 ,
3817 .Sq >
3818 ,
3819 .Sq &
3820 or
3821 .Sq
3822 then at least that part of
3823 .Va expr
3824 must be placed within
3825 .Sq ()
3826 Note that the syntax of
3827 .Va expr
3828 has nothing to do with that described
3829 under
3830 .Va Expressions
3831 .Pp
3832 The fourth and fifth forms increment (
3833 .Sq ++ )
3834 or decrement 
3835 .Sq ( -- )
3836 .Va name
3837 or its
3838 .Va index
3839 'th component.
3840 .Pp
3841 The space between
3842 .Sq @
3843 and
3844 .Va name
3845 is required.
3846 The spaces between
3847 .Va name
3848 and
3849 .Sq =
3850 and between
3851 .Sq =
3852 and
3853 .Va expr
3854 are optional.
3855 Components of
3856 .Va expr
3857 must be separated by spaces.
3858 .It Ar alias[name[wordlist]]
3859 Without arguments, prints all aliases.
3860 With
3861 .Va name
3862 , prints the alias for name.
3863 With
3864 .Va name
3865 and
3866 .Va wordlist
3867 , assigns
3868 .Va wordlist
3869 as the alias of
3870 .Va name
3871 .Va wordlist
3872 is command and filename substituted.
3873 .Va name
3874 may not be
3875 .Sq alias
3876 or
3877 .Sq unalias
3878 See also the
3879 .Va unalias
3880 builtin command.
3881 .It Ar alloc
3882 Shows the amount of dynamic memory acquired, broken down into used and free
3883 memory.
3884 With an argument shows the number of free and used blocks in each size
3885 category.
3886 The categories start at size 8 and double at each step.
3887 This
3888 command's output may vary across system types, because systems other than the VAX
3889 may use a different memory allocator.
3890 .TP 8
3891 .It Ar bg[%job...]
3892 Puts the specified jobs (or, without arguments, the current job)
3893 into the background, continuing each if it is stopped.
3894 .Va job
3895 may be a number, a string,
3896 .Sq
3897 ,
3898 .Sq %
3899 ,
3900 .Sq +
3901 or
3902 .Sq \-
3903 as described
3904 under
3905 .Va Jobs
3906 .Pp
3907 .It Ar bindkey Oo Fl l Ns | Ns Fl d Ns | Ns Fl e Ns | Ns Fl v Ns | Ns Fl u Oc (+)
3908 .It Ar bindkey Oo Fl a Oc Oo Fl b Oc Oo Fl k Oc Oo Fl r Oc Oo Fl Fl Oc Ar key (+)
3909 .It Ar bindkey Oo Fl a Oc Oo Fl b Oc Oo Fl k Oc Oo Fl c Ns | Ns Fl s Oc Oo Fl Fl Oc Ar key command (+)
3910 .\" .It Ar macro can't take too many words, so I used \fB in the previous tags
3911 Without options, the first form lists all bound keys and the editor command to which each is bound,
3912 the second form lists the editor command to which
3913 .Va key
3914 is bound and
3915 the third form binds the editor command
3916 .Va command
3917 to
3918 .Va key
3919 Options include:
3920 .Pp
3921 .Bl -tag -width XXX -compact
3922 .It Fl l
3923 Lists all editor commands and a short description of each.
3924 .It Fl d
3925 Binds all keys to the standard bindings for the default editor,
3926 as per
3927 .Va -e
3928 and
3929 .Va -v
3930 below.
3931 .It Fl e
3932 Binds all keys to
3933 .Va emacs
3934 (1)\-style bindings.
3935 Unsets
3936 .Va vimode
3937 .It Fl v
3938 Binds all keys to
3939 .Va vi
3940 (1)\-style bindings.
3941 Sets
3942 .Va vimode
3943 .It Fl a
3944 Lists or changes key-bindings in the alternative key map.
3945 This is the key map used in
3946 .Va vimode
3947 command mode.
3948 .It Fl b
3949 .Va key
3950 is interpreted as
3951 a control character written ^
3952 .Va character
3953 (e.g.,
3954 .Sq ^A
3955 ) or
3956 C-
3957 .Va character
3958 (e.g.,
3959 .Sq C-A
3960 ),
3961 a meta character written M-
3962 .Va character
3963 (e.g.,
3964 .Sq M-A
3965 ),
3966 a function key written F-
3967 .Va string
3968 (e.g.,
3969 .Sq F-string
3970 ),
3971 or an extended prefix key written X-
3972 .Va character
3973 (e.g.,
3974 .Sq X-A
3975 ).
3976 .It Fl k
3977 .Va key
3978 is interpreted as a symbolic arrow key name, which may be one of
3979 `down',
3980 .Sq up
3981 ,
3982 .Sq left
3983 or
3984 .Sq right
3985 .It Fl r
3986 Removes
3987 .Va key
3988 's binding.
3989 Be careful:
3990 .Sq bindkey \-r
3991 does
3992 .Va not
3993 bind
3994 .Va key
3995 to
3996 .Va self-insert-command
3997 (q.v.), it unbinds
3998 .Va key
3999 completely.
4000 .It Fl c
4001 .Va command
4002 is interpreted as a builtin or external command instead of an
4003 editor command.
4004 .It Fl s
4005 .Va command
4006 is taken as a literal string and treated as terminal input
4007 when
4008 .Va key
4009 is typed.
4010 Bound keys in
4011 .Va command
4012 are themselves
4013 reinterpreted, and this continues for ten levels of interpretation.
4014 .It Fl \&-
4015 Forces a break from option processing, so the next word is taken as
4016 .Va key
4017 even if it begins with '\&-'.
4018 .It Fl u 
4019 (or any invalid option)
4020 Prints a usage message.
4021 .El
4022 .Pp
4023 .Va key
4024 may be a single character or a string.
4025 If a command is bound to a string, the first character of the string is bound to
4026 .Va sequence-lead-in
4027 and the entire string is bound to the command.
4028 .Pp
4029 Control characters in
4030 .Va key
4031 can be literal (they can be typed by preceding
4032 them with the editor command
4033 .Va quoted-insert
4034 , normally bound to
4035 .Sq ^V
4036 ) or
4037 written caret-character style, e.g.,
4038 .Sq ^A
4039 Delete is written
4040 .Sq ^?
4041 (caret-question mark).
4042 .Va key
4043 and
4044 .Va command
4045 can contain backslashed
4046 escape sequences (in the style of System V
4047 .Va echo
4048 (1)) as follows:
4049 .Pp
4050 .Bl -tag -width XXXX -compact -offset indent
4051 .It \ea
4052 Bell
4053 .It \eb
4054 Backspace
4055 .It \ee
4056 Escape
4057 .It \ef
4058 Form feed
4059 .It \en
4060 Newline
4061 .It \er
4062 Carriage return
4063 .It \et
4064 Horizontal tab
4065 .It \ev
4066 Vertical tab
4067 .It \e\fInnn
4068 The ASCII character corresponding to the octal number
4069 .Va nnn
4070 .El
4071 .Pp
4072 `\e' nullifies the special meaning of the following character, if it has
4073 any, notably
4074 .Sq \e
4075 and
4076 .Sq ^
4077 .It bs2cmd Va bs2000-command
4078 (+)
4079 Passes
4080 .Va bs2000-command
4081 to the BS2000 command interpreter for
4082 execution. Only non-interactive commands can be executed, and it is
4083 not possible to execute any command that would overlay the image
4084 of the current process, like /EXECUTE or /CALL-PROCEDURE. (BS2000 only)
4085 .It break
4086 Causes execution to resume after the
4087 .Va end
4088 of the nearest
4089 enclosing
4090 .Va foreach
4091 or
4092 .Va while
4093 The remaining commands on the
4094 current line are executed.
4095 Multi-level breaks are thus
4096 possible by writing them all on one line.
4097 .It breaksw
4098 Causes a break from a
4099 .Va switch
4100 , resuming after the
4101 .Va endsw
4102
4103 .It builtins \fR(+)
4104 Prints the names of all builtin commands.
4105
4106 .It bye \fR(+)
4107 A synonym for the
4108 .Va logout
4109 builtin command.
4110 Available only if the shell was so compiled;
4111 see the
4112 .Va version
4113 shell variable.
4114
4115 .It case \fIlabel\fB:
4116 A label in a
4117 .Va switch
4118 statement as discussed below.
4119
4120 .It cd \fR[
4121 .Fl p\fR] [
4122 .Fl l\fR] [
4123 .Fl n\fR|
4124 .Fl v\fR] [\I--\fR] [
4125 .Va name
4126 ]
4127 If a directory
4128 .Va name
4129 is given, changes the shell's working directory
4130 to
4131 .Va name
4132 If not, changes to
4133 .Va home
4134 , unless the
4135 .Va cdtohome
4136 variable is not set, in which case a
4137 .Va name
4138 is required.
4139 If
4140 .Va name
4141 is
4142 .Sq \-
4143 it is interpreted as the previous working directory
4144 (see
4145 .Va Other substitutions
4146 ).
4147 (+)
4148 If
4149 .Va name
4150 is not a subdirectory of the current directory
4151 (and does not begin with
4152 .Sq /
4153 ,
4154 .Sq ./
4155 or
4156 .Sq ../
4157 ), each component of the variable
4158 .Va cdpath
4159 is checked to see if it has a subdirectory
4160 .Va name
4161 Finally, if
4162 all else fails but
4163 .Va name
4164 is a shell variable whose value
4165 begins with
4166 .Sq /
4167 or '.', then this is tried to see if it is a directory, and
4168 the
4169 .Fl p\fR option is implied.
4170 .RS +8
4171 .Pp
4172 With
4173 .Fl p\fR, prints the final directory stack, just like
4174 .Va dirs
4175 The
4176 .Fl l\fR,
4177 .Fl n\fR and
4178 .Fl v\fR flags have the same effect on
4179 .Va cd
4180 as on
4181 .Va dirs
4182 , and they imply
4183 .Fl p\fR.
4184 (+)
4185 Using
4186 .Fl \-\fR forces a break from option processing so the next word
4187 is taken as the directory
4188 .Va name
4189 even if it begins with '\-'. (+)
4190 .Pp
4191 See also the
4192 .Va implicitcd
4193 and
4194 .Va cdtohome
4195 shell variables.
4196 .RE
4197
4198 .It chdir
4199 A synonym for the
4200 .Va cd
4201 builtin command.
4202
4203 .It complete \fR[
4204 .Va command
4205 [\fIword\fB/\fIpattern\fB/
4206 .Va list
4207 [\fB:
4208 .Va select
4209 ]
4210 .Va /
4211 [[
4212 .Va suffix
4213 ]
4214 .Va /
4215 ] ...]] (+)
4216 Without arguments, lists all completions.
4217 With
4218 .Va command
4219 , lists completions for
4220 .Va command
4221 With
4222 .Va command
4223 and
4224 .Va word
4225 etc., defines completions.
4226 .RS +8
4227 .Pp
4228 .Va command
4229 may be a full command name or a glob-pattern
4230 (see
4231 .Va Filename substitution
4232 ).
4233 It can begin with
4234 .Sq \-
4235 to indicate that
4236 completion should be used only when
4237 .Va command
4238 is ambiguous.
4239 .Pp
4240 .Va word
4241 specifies which word relative to the current word
4242 is to be completed, and may be one of the following:
4243 .Pp
4244 .PD 0
4245 .RS +4
4246 .TP 4
4247 .It c
4248 Current-word completion.
4249 .Va pattern
4250 is a glob-pattern which must match the beginning of the current word on
4251 the command line.
4252 .Va pattern
4253 is ignored when completing the current word.
4254 .TP 4
4255 .It C
4256 Like
4257 .Va c
4258 , but includes
4259 .Va pattern
4260 when completing the current word.
4261 .TP 4
4262 .It n
4263 Next-word completion.
4264 .Va pattern
4265 is a glob-pattern which must match the beginning of the previous word on
4266 the command line.
4267 .TP 4
4268 .It N
4269 Like
4270 .Va n
4271 , but must match the beginning of the word two before the current word.
4272 .TP 4
4273 .It p
4274 Position-dependent completion.
4275 .Va pattern
4276 is a numeric range, with the same syntax used to index shell
4277 variables, which must include the current word.
4278 .PD
4279 .RE
4280 .Pp
4281 .Va list
4282 , the list of possible completions, may be one of the following:
4283 .Pp
4284 .Bl -tag
4285 .It a
4286 Aliases
4287 .It b
4288 Bindings (editor commands)
4289 .It c
4290 Commands (builtin or external commands)
4291 .It C
4292 External commands which begin with the supplied path prefix
4293 .It d
4294 Directories
4295 .It D
4296 Directories which begin with the supplied path prefix
4297 .It e
4298 Environment variables
4299 .It f
4300 Filenames
4301 .It F
4302 Filenames which begin with the supplied path prefix
4303 .It g
4304 Groupnames
4305 .It j
4306 Jobs
4307 .It l
4308 Limits
4309 .It n
4310 Nothing
4311 .It s
4312 Shell variables
4313 .It S
4314 Signals
4315 .It t
4316 Plain (
4317 .Dq text )
4318 files
4319 .It T
4320 Plain (
4321 .Dq text )
4322 files which begin with the supplied path prefix
4323 .It v
4324 Any variables
4325 .It u
4326 Usernames
4327 .It x
4328 Like
4329 .Va n ,
4330 but prints
4331 .Va select
4332 when
4333 .Va list-choices
4334 is used.
4335 .It X
4336 Completions
4337 $
4338 .Va var
4339 Words from the variable
4340 .Va var
4341 (...)
4342 Words from the given list
4343 \`...\`
4344 Words from the output of command
4345 .El
4346 .Pp
4347 .Va select
4348 is an optional glob-pattern.
4349 If given, words from only
4350 .Va list
4351 that match
4352 .Va select
4353 are considered
4354 and the
4355 .Va fignore
4356 shell variable is ignored.
4357 The last three types of completion may not have a
4358 .Va select
4359 pattern, and
4360 .Va x
4361 uses
4362 .Va select
4363 as an explanatory message when
4364 the
4365 .Va list-choices
4366 editor command is used.
4367 .Pp
4368 .Va suffix
4369 is a single character to be appended to a successful
4370 completion.
4371 If null, no character is appended.
4372 If omitted (in which
4373 case the fourth delimiter can also be omitted), a slash is appended to
4374 directories and a space to other words.
4375 .Pp
4376 .Va command
4377 invoked from \`...\` version has additional environment
4378 variable set, the variable name is \%
4379 .Va COMMAND_LINE
4380 \% and
4381 contains (as its name indicates) contents of the current (already
4382 typed in) command line. One can examine and use contents of the
4383 \%
4384 .Va COMMAND_LINE
4385 \% variable in her custom script to build more
4386 sophisticated completions (see completion for svn(1) included in
4387 this package).
4388 .Pp
4389 Now for some examples.
4390 Some commands take only directories as arguments,
4391 so there's no point completing plain files.
4392 .IP "" 4
4393 > complete cd 'p/1/d/'
4394 .Pp
4395 completes only the first word following
4396 .Sq cd
4397 (`p/1') with a directory.
4398 .Va p
4399 -type completion can also be used to narrow down command completion:
4400 .IP "" 4
4401 > co[^D]
4402 .br
4403 complete compress
4404 .br
4405 > complete \-co* 'p/0/(compress)/'
4406 .br
4407 > co[^D]
4408 .br
4409 > compress
4410 .Pp
4411 This completion completes commands (words in position 0,
4412 .Sq p/0
4413 )
4414 which begin with
4415 .Sq co
4416 (thus matching
4417 .Sq co*
4418 ) to
4419 .Sq compress
4420 (the only
4421 word in the list).
4422 The leading
4423 .Sq \-
4424 indicates that this completion is to be used with only
4425 ambiguous commands.
4426 .IP "" 4
4427 > complete find 'n/\-user/u/'
4428 .Pp
4429 is an example of
4430 .Va n
4431 -type completion.
4432 Any word following
4433 .Sq find
4434 and
4435 immediately following
4436 .Sq \-user
4437 is completed from the list of users.
4438 .IP "" 4
4439 > complete cc 'c/\-I/d/'
4440 .Pp
4441 demonstrates
4442 .Va c
4443 -type completion.
4444 Any word following
4445 .Sq cc
4446 and beginning
4447 with
4448 .Sq \-I
4449 is completed as a directory.
4450 `\-I' is not taken as part of the
4451 directory because we used lowercase
4452 .Va c
4453 .Pp
4454 Different
4455 .Va list
4456 s are useful with different commands.
4457 .IP "" 4
4458 > complete alias 'p/1/a/'
4459 .br
4460 > complete man 'p/*/c/'
4461 .br
4462 > complete set 'p/1/s/'
4463 .br
4464 > complete true 'p/1/x:Truth has no options./'
4465 .Pp
4466 These complete words following
4467 .Sq alias
4468 with aliases,
4469 .Sq man
4470 with commands,
4471 and
4472 .Sq set
4473 with shell variables.
4474 `true' doesn't have any options, so
4475 .Va x
4476 does nothing when completion
4477 is attempted and prints
4478 .Sq Truth has no options.
4479 when completion choices are listed.
4480 .Pp
4481 Note that the
4482 .Va man
4483 example, and several other examples below, could
4484 just as well have used 'c/*' or 'n/*' as 'p/*'.
4485 .Pp
4486 Words can be completed from a variable evaluated at completion time,
4487 .IP "" 4
4488 > complete ftp 'p/1/$hostnames/'
4489 .br
4490 > set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu)
4491 .br
4492 > ftp [^D]
4493 .br
4494 rtfm.mit.edu tesla.ee.cornell.edu
4495 .br
4496 > ftp [^C]
4497 .br
4498 > set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net)
4499 .br
4500 > ftp [^D]
4501 .br
4502 rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net
4503 .Pp
4504 or from a command run at completion time:
4505 .IP "" 4
4506 > complete kill 'p/*/\`ps | awk \e{print\e \e$1\e}\`/'
4507 .br
4508 > kill \-9 [^D]
4509 .br
4510 23113 23377 23380 23406 23429 23529 23530 PID
4511 .Pp
4512 Note that the
4513 .Va complete
4514 command does not itself quote its arguments,
4515 so the braces, space and
4516 .Sq $
4517 in
4518 .Sq {print $1}
4519 must be quoted explicitly.
4520 .Pp
4521 One command can have multiple completions:
4522 .IP "" 4
4523 > complete dbx 'p/2/(core)/' 'p/*/c/'
4524 .Pp
4525 completes the second argument to
4526 .Sq dbx
4527 with the word
4528 .Sq core
4529 and all other
4530 arguments with commands.
4531 Note that the positional completion is specified
4532 before the next-word completion.
4533 Because completions are evaluated from left to right, if
4534 the next-word completion were specified first it would always match
4535 and the positional completion would never be executed.
4536 This is a
4537 common mistake when defining a completion.
4538 .Pp
4539 The
4540 .Va select
4541 pattern is useful when a command takes files with only
4542 particular forms as arguments.
4543 For example,
4544 .IP "" 4
4545 > complete cc 'p/*/f:*.[cao]/'
4546 .Pp
4547 completes
4548 .Sq cc
4549 arguments to files ending in only
4550 .Sq .c
4551 ,
4552 .Sq .a
4553 , or
4554 .Sq .o
4555 .Va select
4556 can also exclude files, using negation of a glob-pattern as
4557 described under
4558 .Va Filename substitution
4559 One might use
4560 .IP "" 4
4561 > complete rm 'p/*/f:^*.{c,h,cc,C,tex,1,man,l,y}/'
4562 .Pp
4563 to exclude precious source code from
4564 .Sq rm
4565 completion.
4566 Of course, one
4567 could still type excluded names manually or override the completion
4568 mechanism using the
4569 .Va complete-word-raw
4570 or
4571 .Va list-choices-raw
4572 editor commands (q.v.).
4573 .Pp
4574 The
4575 .Sq C
4576 ,
4577 .Sq D
4578 ,
4579 .Sq F
4580 and
4581 .Sq T
4582
4583 .Va list
4584 s are like
4585 .Sq c
4586 ,
4587 .Sq d
4588 ,
4589 .Sq f
4590 and
4591 .Sq t
4592 respectively, but they use the
4593 .Va select
4594 argument in a different way: to
4595 restrict completion to files beginning with a particular path prefix.
4596 For
4597 example, the Elm mail program uses
4598 .Sq =
4599 as an abbreviation for one's mail
4600 directory.
4601 One might use
4602 .IP "" 4
4603 > complete elm c@=@F:$HOME/Mail/@
4604 .Pp
4605 to complete
4606 .Sq elm \-f =
4607 as if it were
4608 .Sq elm \-f ~/Mail/
4609 Note that we used
4610 .Sq @
4611 instead of
4612 .Sq /
4613 to avoid confusion with the
4614 .Va select
4615 argument, and we used
4616 `$HOME' instead of
4617 .Sq ~
4618 because home directory substitution works at only the
4619 beginning of a word.
4620 .Pp
4621 .Va suffix
4622 is used to add a nonstandard suffix
4623 (not space or
4624 .Sq /
4625 for directories) to completed words.
4626 .IP "" 4
4627 > complete finger 'c/*@/$hostnames/' 'p/1/u/@'
4628 .Pp
4629 completes arguments to
4630 .Sq finger
4631 from the list of users, appends an
4632 .Sq @
4633 ,
4634 and then completes after the
4635 .Sq @
4636 from the
4637 .Sq hostnames
4638 variable.
4639 Note
4640 again the order in which the completions are specified.
4641 .Pp
4642 Finally, here's a complex example for inspiration:
4643 .IP "" 4
4644 > complete find \e
4645 .br
4646 \&'n/\-name/f/' 'n/\-newer/f/' 'n/\-{,n}cpio/f/' \e
4647 .br
4648 \&\'n/\-exec/c/' 'n/\-ok/c/' 'n/\-user/u/' \e
4649 .br
4650 \&'n/\-group/g/' 'n/\-fstype/(nfs 4.2)/' \e
4651 .br
4652 \&'n/\-type/(b c d f l p s)/' \e
4653 .br
4654 \'c/\-/(name newer cpio ncpio exec ok user \e
4655 .br
4656 group fstype type atime ctime depth inum \e
4657 .br
4658 ls mtime nogroup nouser perm print prune \e
4659 .br
4660 size xdev)/' \e
4661 .br
4662 \&'p/*/d/'
4663 .Pp
4664 This completes words following
4665 .Sq \-name
4666 ,
4667 .Sq \-newer
4668 ,
4669 .Sq \-cpio
4670 or
4671 .Sq ncpio
4672 (note the pattern which matches both) to files,
4673 words following
4674 .Sq \-exec
4675 or
4676 .Sq \-ok
4677 to commands, words following
4678 .Sq user
4679 and
4680 .Sq group
4681 to users and groups respectively
4682 and words following
4683 .Sq \-fstype
4684 or
4685 .Sq \-type
4686 to members of the
4687 given lists.
4688 It also completes the switches themselves from the given list
4689 (note the use of
4690 .Va c
4691 -type completion)
4692 and completes anything not otherwise completed to a directory.
4693 Whew.
4694 .Pp
4695 Remember that programmed completions are ignored if the word being completed
4696 is a tilde substitution (beginning with
4697 .Sq ~
4698 ) or a variable (beginning with
4699 .Sq $
4700 ).
4701 See also the
4702 .Va uncomplete
4703 builtin command.
4704 .RE
4705 .TP 8
4706 .B continue
4707 Continues execution of the nearest enclosing
4708 .Va while
4709 or
4710 .Va foreach
4711 The rest of the commands on the current line are executed.
4712 .TP 8
4713 .B default:
4714 Labels the default case in a
4715 .Va switch
4716 statement.
4717 It should come after all
4718 .Va case
4719 labels.
4720 .Pp
4721 .B dirs \fR[
4722 .Fl l\fR] [
4723 .Fl n\fR|
4724 .Fl v\fR]
4725 .br
4726 .B dirs \-S\fR|
4727 .Fl L \fR[
4728 .Va filename
4729 ] (+)
4730 .PD 0
4731 .TP 8
4732 .B dirs \-c \fR(+)
4733 The first form prints the directory stack.
4734 The top of the stack is at the
4735 left and the first directory in the stack is the current directory.
4736 With
4737 .Fl l\fR,
4738 .Sq ~
4739 or
4740 .Sq ~\fIname\fP
4741 in the output is expanded explicitly
4742 to
4743 .Va home
4744 or the pathname of the home directory for user \fIname\fP.
4745 (+)
4746 With
4747 .Fl n\fR, entries are wrapped before they reach the edge of the screen.
4748 (+)
4749 With
4750 .Fl v\fR, entries are printed one per line, preceded by their stack positions.
4751 (+)
4752 If more than one of
4753 .Fl n\fR or
4754 .Fl v\fR is given,
4755 .Fl v\fR takes precedence.
4756 .Fl p\fR is accepted but does nothing.
4757 .PD
4758 .RS +8
4759 .Pp
4760 With
4761 .Fl S\fR, the second form saves the directory stack to
4762 .Va filename
4763 as a series of
4764 .Va cd
4765 and
4766 .Va pushd
4767 commands.
4768 With
4769 .Fl L\fR, the shell sources
4770 .Va filename
4771 , which is presumably
4772 a directory stack file saved by the
4773 .Fl S\fR option or the
4774 .Va savedirs
4775 mechanism.
4776 In either case,
4777 .Va dirsfile
4778 is used if
4779 .Va filename
4780 is not given and
4781 .Va ~/.cshdirs
4782 is used if
4783 .Va dirsfile
4784 is unset.
4785 .Pp
4786 Note that login shells do the equivalent of
4787 .Sq dirs \-L
4788 on startup
4789 and, if
4790 .Va savedirs
4791 is set,
4792 .Sq dirs \-S
4793 before exiting.
4794 Because only
4795 .Va ~/.tcshrc
4796 is normally sourced before
4797 .Va ~/.cshdirs
4798 ,
4799 .Va dirsfile
4800 should be set in
4801 .Va ~/.tcshrc
4802 rather than
4803 .Va ~/.login
4804 .Pp
4805 The last form clears the directory stack.
4806 .RE
4807 .TP 8
4808 .B echo \fR[
4809 .Fl n\fR]
4810 .Va word
4811 ...
4812 Writes each
4813 .Va word
4814 to the shell's standard
4815 output, separated by spaces and terminated with a newline.
4816 The
4817 .Va echo_style
4818 shell variable may be set to emulate (or not) the flags and escape
4819 sequences of the BSD and/or System V versions of
4820 .Va echo
4821 ; see
4822 .Va echo
4823 (1).
4824 .TP 8
4825 .B echotc \fR[
4826 .Fl sv\fR]
4827 .Va arg
4828 ... (+)
4829 Exercises the terminal capabilities (see
4830 .Va termcap
4831 (5)) in
4832 .Va args
4833 For example, 'echotc home' sends the cursor to the home position,
4834 \&'echotc cm 3 10' sends it to column 3 and row 10, and
4835 \&'echotc ts 0; echo "This is a test."; echotc fs' prints "This is a test."
4836 in the status line.
4837 .RS +8
4838 .Pp
4839 If
4840 .Va arg
4841 is 'baud', 'cols', 'lines', 'meta' or 'tabs', prints the
4842 value of that capability ("yes" or "no" indicating that the terminal does
4843 or does not have that capability).
4844 One might use this to make the output
4845 from a shell script less verbose on slow terminals, or limit command
4846 output to the number of lines on the screen:
4847 .IP "" 4
4848 > set history=\`echotc lines\`
4849 .br
4850 > @ history\-\-
4851 .Pp
4852 Termcap strings may contain wildcards which will not echo correctly.
4853 One should use double quotes when setting a shell variable to a terminal
4854 capability string, as in the following example that places the date in
4855 the status line:
4856 .IP "" 4
4857 > set tosl="\`echotc ts 0\`"
4858 .br
4859 > set frsl="\`echotc fs\`"
4860 .br
4861 > echo \-n "$tosl";date; echo \-n "$frsl"
4862 .Pp
4863 With
4864 .Fl s\fR, nonexistent capabilities return the empty string rather
4865 than causing an error.
4866 With
4867 .Fl v\fR, messages are verbose.
4868 .RE
4869 .Pp
4870 .B else
4871 .br
4872 .B end
4873 .br
4874 .B endif
4875 .PD 0
4876 .TP 8
4877 .B endsw
4878 See the description of the
4879 .Va foreach
4880 ,
4881 .Va if
4882 ,
4883 .Va switch
4884 , and
4885 .Va while
4886 statements below.
4887 .PD
4888 .TP 8
4889 .B eval
4890 .Va arg
4891 ...
4892 Treats the arguments as input to the
4893 shell and executes the resulting command(s) in the context
4894 of the current shell.
4895 This is usually used to execute commands
4896 generated as the result of command or variable substitution,
4897 because parsing occurs before these substitutions.
4898 See
4899 .Va tset
4900 (1) for a sample use of
4901 .Va eval
4902 .TP 8
4903 .B exec
4904 .Va command
4905 Executes the specified command in place of the current shell.
4906 .TP 8
4907 .B exit \fR[
4908 .Va expr
4909 ]
4910 The shell exits either with the value of the specified
4911 .Va expr
4912 (an expression, as described under
4913 .Va Expressions
4914 )
4915 or, without
4916 .Va expr
4917 , with the value 0.
4918 .TP 8
4919 .B fg \fR[\fB%
4920 .Va job
4921 ...]
4922 Brings the specified jobs (or, without arguments, the current job)
4923 into the foreground, continuing each if it is stopped.
4924 .Va job
4925 may be a number, a string,
4926 .Sq
4927 ,
4928 .Sq %
4929 ,
4930 .Sq +
4931 or
4932 .Sq \-
4933 as described
4934 under
4935 .Va Jobs
4936 See also the
4937 .Va run-fg-editor
4938 editor command.
4939 .TP 8
4940 .B filetest \-
4941 .Va op file
4942 ... (+)
4943 Applies
4944 .Va op
4945 (which is a file inquiry operator as described under
4946 .Va File inquiry operators
4947 ) to each
4948 .Va file
4949 and returns the results as a
4950 space-separated list.
4951 .Pp
4952 .B foreach \fIname \fB(\fIwordlist\fB)
4953 .br
4954 \&...
4955 .PD 0
4956 .TP 8
4957 .B end
4958 Successively sets the variable
4959 .Va name
4960 to each member of
4961 .Va wordlist
4962 and executes the sequence of commands between this command
4963 and the matching
4964 .Va end
4965 (Both
4966 .Va foreach
4967 and
4968 .Va end
4969 must appear alone on separate lines.)  The builtin command
4970 .Va continue
4971 may be used to continue the loop prematurely and
4972 the builtin command
4973 .Va break
4974 to terminate it prematurely.
4975 When this command is read from the terminal, the loop is read once
4976 prompting with
4977 .Sq foreach?
4978 (or
4979 .Va prompt2
4980 ) before any statements in
4981 the loop are executed.
4982 If you make a mistake typing in a
4983 loop at the terminal you can rub it out.
4984 .PD
4985 .TP 8
4986 .B getspath \fR(+)
4987 Prints the system execution path.
4988 (TCF only)
4989 .TP 8
4990 .B getxvers \fR(+)
4991 Prints the experimental version prefix.
4992 (TCF only)
4993 .TP 8
4994 .B glob \fIwordlist
4995 Like
4996 .Va echo
4997 , but the
4998 .Sq -n
4999 parameter is not recognized and words are
5000 delimited by null characters in the output.
5001 Useful for
5002 programs which wish to use the shell to filename expand a list of words.
5003 .TP 8
5004 .B goto \fIword
5005 .Va word
5006 is filename and command-substituted to
5007 yield a string of the form
5008 .Sq label
5009 The shell rewinds its
5010 input as much as possible, searches for a line of the
5011 form
5012 .Sq label:
5013 , possibly preceded by blanks or tabs, and
5014 continues execution after that line.
5015 .TP 8
5016 .B hashstat
5017 Prints a statistics line indicating how effective the
5018 internal hash table has been at locating commands (and avoiding
5019 .Va exec
5020 's).
5021 An
5022 .Va exec
5023 is attempted for each component of the
5024 .Va path
5025 where the hash function indicates a possible hit, and
5026 in each component which does not begin with a
5027 .Sq /
5028 .IP
5029 On machines without
5030 .Va vfork
5031 (2), prints only the number and size of
5032 hash buckets.
5033 .Pp
5034 .B history \fR[
5035 .Fl hTr\fR] [
5036 .Va n
5037 ]
5038 .br
5039 .B history \-S\fR|
5040 .Fl L|
5041 .Fl M \fR[
5042 .Va filename
5043 ] (+)
5044 .PD 0
5045 .TP 8
5046 .B history \-c \fR(+)
5047 The first form prints the history event list.
5048 If
5049 .Va n
5050 is given only the
5051 .Va n
5052 most recent events are printed or saved.
5053 With
5054 .Fl h\fR, the history list is printed without leading numbers.
5055 If
5056 .Va -T
5057 is specified, timestamps are printed also in comment form.
5058 (This can be used to
5059 produce files suitable for loading with 'history \-L' or 'source \-h'.)
5060 With
5061 .Fl r\fR, the order of printing is most recent
5062 first rather than oldest first.
5063 .PD
5064 .RS +8
5065 .Pp
5066 With
5067 .Fl S\fR, the second form saves the history list to
5068 .Va filename
5069 If the first word of the
5070 .Va savehist
5071 shell variable is set to a
5072 number, at most that many lines are saved.
5073 If the second word of
5074 .Va savehist
5075 is set to
5076 .Sq merge
5077 , the history list is merged with the
5078 existing history file instead of replacing it (if there is one) and
5079 sorted by time stamp.
5080 (+) Merging is intended for an environment like
5081 the X Window System
5082 with several shells in simultaneous use.
5083 If the second word of
5084 .Va savehist
5085 is
5086 .Sq merge
5087 and the third word is set to
5088 .Sq lock
5089 , the history file update
5090 will be serialized with other shell sessions that would possibly like
5091 to merge history at exactly the same time.
5092 .Pp
5093 With
5094 .Fl L\fR, the shell appends
5095 .Va filename
5096 , which is presumably a
5097 history list saved by the
5098 .Fl S\fR option or the
5099 .Va savehist
5100 mechanism,
5101 to the history list.
5102 .Fl M\fR is like
5103 .Fl L\fR, but the contents of
5104 .Va filename
5105 are merged
5106 into the history list and sorted by timestamp.
5107 In either case,
5108 .Va histfile
5109 is used if
5110 .Va filename
5111 is not given and
5112 .Va ~/.history
5113 is used if
5114 .Va histfile
5115 is unset.
5116 `history \-L' is exactly like 'source \-h' except that it does not require a
5117 filename.
5118 .Pp
5119 Note that login shells do the equivalent of
5120 .Sq history \-L
5121 on startup
5122 and, if
5123 .Va savehist
5124 is set,
5125 .Sq history \-S
5126 before exiting.
5127 Because only
5128 .Va ~/.tcshrc
5129 is normally sourced before
5130 .Va ~/.history
5131 ,
5132 .Va histfile
5133 should be set in
5134 .Va ~/.tcshrc
5135 rather than
5136 .Va ~/.login
5137 .Pp
5138 If
5139 .Va histlit
5140 is set, the first and second forms print and save the literal
5141 (unexpanded) form of the history list.
5142 .Pp
5143 The last form clears the history list.
5144 .RE
5145 .TP 8
5146 .B hup \fR[
5147 .Va command
5148 ] \fR(+)
5149 With
5150 .Va command
5151 , runs
5152 .Va command
5153 such that it will exit on a hangup
5154 signal and arranges for the shell to send it a hangup signal when the shell
5155 exits.
5156 Note that commands may set their own response to hangups, overriding
5157 .Va hup
5158 Without an argument, causes the non-interactive shell only to
5159 exit on a hangup for the remainder of the script.
5160 See also
5161 .Va Signal handling
5162 and the
5163 .Va nohup
5164 builtin command.
5165 .TP 8
5166 .B if (\fIexpr\fB) \fIcommand
5167 If
5168 .Va expr
5169 (an expression, as described under
5170 .Va Expressions
5171 )
5172 evaluates true, then
5173 .Va command
5174 is executed.
5175 Variable substitution on
5176 .Va command
5177 happens early, at the same time it
5178 does for the rest of the
5179 .Va if
5180 command.
5181 .Va command
5182 must be a simple command, not an alias, a pipeline, a command list
5183 or a parenthesized command list, but it may have arguments.
5184 Input/output redirection occurs even if
5185 .Va expr
5186 is
5187 false and
5188 .Va command
5189 is thus
5190 .Va not
5191 executed; this is a bug.
5192 .Pp
5193 .B if (\fIexpr\fB) then
5194 .br
5195 \&...
5196 .br
5197 .B else if (\fIexpr2\fB) then
5198 .br
5199 \&...
5200 .br
5201 .B else
5202 .br
5203 \&...
5204 .PD 0
5205 .TP 8
5206 .B endif
5207 If the specified
5208 .Va expr
5209 is true then the commands to the
5210 first
5211 .Va else
5212 are executed; otherwise if
5213 .Va expr2
5214 is true then
5215 the commands to the second
5216 .Va else
5217 are executed, etc.
5218 Any
5219 number of
5220 .Va else-if
5221 pairs are possible; only one
5222 .Va endif
5223 is
5224 needed.
5225 The
5226 .Va else
5227 part is likewise optional.
5228 (The words
5229 .Va else
5230 and
5231 .Va endif
5232 must appear at the beginning of input lines;
5233 the
5234 .Va if
5235 must appear alone on its input line or after an
5236 .Va else
5237 .)
5238 .PD
5239 .TP 8
5240 .B inlib
5241 .Va shared-library
5242 ... (+)
5243 Adds each
5244 .Va shared-library
5245 to the current environment.
5246 There is no way
5247 to remove a shared library.
5248 (Domain/OS only)
5249 .TP 8
5250 .B jobs \fR[
5251 .Fl l\fR]
5252 Lists the active jobs.
5253 With
5254 .Fl l\fR, lists process
5255 IDs in addition to the normal information.
5256 On TCF systems, prints
5257 the site on which each job is executing.
5258 .Pp
5259 .PD 0
5260 .TP 8
5261 .B kill \fR[
5262 .Fl s
5263 .Va signal
5264 ] \fB%
5265 .Va job
5266 |
5267 .Va pid
5268 ...
5269 .PD 0
5270 .TP 8
5271 .B kill \-l
5272 The first and second forms sends the specified
5273 .Va signal
5274 (or, if none
5275 is given, the TERM (terminate) signal) to the specified jobs or processes.
5276 .Va job
5277 may be a number, a string,
5278 .Sq
5279 ,
5280 .Sq %
5281 ,
5282 .Sq +
5283 or
5284 .Sq \-
5285 as described
5286 under
5287 .Va Jobs
5288 Signals are either given by number or by name (as given in
5289 .Va /usr/include/signal.h
5290 , stripped of the prefix
5291 .Sq SIG
5292 ).
5293 There is no default
5294 .Va job
5295 ; saying just
5296 .Sq kill
5297 does not send a signal
5298 to the current job.
5299 If the signal being sent is TERM (terminate)
5300 or HUP (hangup), then the job or process is sent a
5301 CONT (continue) signal as well.
5302 The third form lists the signal names.
5303 .PD
5304 .TP 8
5305 .B limit \fR[
5306 .Fl h\fR] [
5307 .Va resource
5308 [
5309 .Va maximum-use
5310 ]]
5311 Limits the consumption by the current process and each
5312 process it creates to not individually exceed
5313 .Va maximum-use
5314 on
5315 the specified
5316 .Va resource
5317 If no
5318 .Va maximum-use
5319 is given, then
5320 the current limit is printed; if no
5321 .Va resource
5322 is given, then
5323 all limitations are given.
5324 If the
5325 .Fl h\fR flag is given, the
5326 hard limits are used instead of the current limits.
5327 The
5328 hard limits impose a ceiling on the values of the current
5329 limits.
5330 Only the super-user may raise the hard limits, but
5331 a user may lower or raise the current limits within the legal range.
5332 .Pp
5333 Controllable resources currently include (if supported by the OS):
5334 .Bl -tag -width pseudoterminals -compact -offset indent
5335 .It Va cputime
5336 the maximum number of cpu-seconds to be used by each process
5337 .It Va filesize
5338 the largest single file which can be created
5339 .It Va datasize
5340 the maximum growth of the data+stack region via sbrk(2) beyond
5341 the end of the program text
5342 .It Va stacksize
5343 the maximum size of the automatically-extended stack region
5344 .It Va coredumpsize
5345 the size of the largest core dump that will be created
5346 .It Va memoryuse
5347 the maximum amount of physical memory a process
5348 may have allocated to it at a given time
5349 .It Va vmemoryuse
5350 the maximum amount of virtual memory a process
5351 may have allocated to it at a given time (address space)
5352 .It Va vmemoryuse
5353 the maximum amount of virtual memory a process
5354 may have allocated to it at a given time
5355 .It Va heapsize
5356 the maximum amount of memory a process
5357 may allocate per
5358 .Xr brk 2
5359 system call
5360 .It Va descriptors
5361 or
5362 .It Va openfiles
5363 the maximum number of open files for this process
5364 .It Va pseudoterminals
5365 the maximum number of pseudo-terminals for this user
5366 .It Va kqueues
5367 the maximum number of kqueues allocated for this process
5368 .It Va concurrency
5369 the maximum number of threads for this process
5370 .It Va memorylocked
5371 the maximum size which a process may lock into memory using mlock(2)
5372 .It Va maxproc
5373 the maximum number of simultaneous processes for this user id
5374 .It Va maxthread
5375 the maximum number of simultaneous threads (lightweight processes) for this
5376 user id
5377 .It Va threads
5378 the maximum number of threads for this process
5379 .It Va sbsize
5380 the maximum size of socket buffer usage for this user
5381 .It Va swapsize
5382 the maximum amount of swap space reserved or used for this user
5383 .It Va maxlocks
5384 the maximum number of locks for this user
5385 .It Va posixlocks
5386 the maximum number of POSIX advisory locks for this user
5387 .It Va maxsignal
5388 the maximum number of pending signals for this user
5389 .It Va maxmessage
5390 the maximum number of bytes in POSIX mqueues for this user
5391 .It Va maxnice
5392 the maximum nice priority the user is allowed to raise mapped from [19...-20]
5393 to [0...39] for this user
5394 .It Va maxrtprio
5395 the maximum realtime priority for this user
5396 .It Va maxrttime
5397 the timeout for RT tasks in microseconds for this user.
5398 .El
5399 .Pp
5400 .Va maximum-use
5401 may be given as a (floating point or
5402 integer) number followed by a scale factor.
5403 For all limits
5404 other than
5405 .Va cputime
5406 the default scale is
5407 .Sq k
5408 or
5409 .Sq kilobytes
5410 (1024 bytes); a scale factor of
5411 .Sq m
5412 or
5413 .Sq megabytes
5414 or
5415 .Sq g
5416 or
5417 .Sq gigabytes
5418 may also be used.
5419 For
5420 .Va cputime
5421 the default scaling is
5422 .Sq seconds ,
5423 while
5424 .Sq m
5425 for minutes or
5426 .Sq h
5427 for hours, or a time of the
5428 form
5429 .Sq mm:ss
5430 giving minutes and seconds may be used.
5431 .Pp
5432 If
5433 .Va maximum-use
5434 is
5435 .Sq unlimited ,
5436 then the limitation on the specified
5437 .Va resource
5438 is removed (this is equivalent to the
5439 .Va unlimit
5440 builtin command).
5441 .Pp
5442 For both
5443 .Va resource
5444 names and scale factors, unambiguous
5445 prefixes of the names suffice.
5446 .RE
5447 .TP 8
5448 .B log \fR(+)
5449 Prints the
5450 .Va watch
5451 shell variable and reports on each user indicated
5452 in
5453 .Va watch
5454 who is logged in, regardless of when they last logged in.
5455 See also
5456 .Va watchlog
5457 .TP 8
5458 .B login
5459 Terminates a login shell, replacing it with an instance of
5460 .Va /bin/login
5461 . This is one way to log off, included for
5462 compatibility with
5463 .Xr sh 1 .
5464 .TP 8
5465 .B logout
5466 Terminates a login shell.
5467 Especially useful if
5468 .Va ignoreeof
5469 is set.
5470 .TP 8
5471 .B ls\-F \fR[\-
5472 .Va switch
5473 ...] [
5474 .Va file
5475 ...] (+)
5476 Lists files like
5477 .Sq ls \-F
5478 , but much faster.
5479 It identifies each type of
5480 special file in the listing with a special character:
5481 .Bl -tag -width x -offset indent -compact
5482 .It Dv /
5483 Directory
5484 .It Dv *
5485 Executable
5486 .It Dv #
5487 Block device
5488 .It Dv %
5489 Character device
5490 .It Dv |
5491 Named pipe (systems with named pipes only)
5492 .It Dv =
5493 Socket (systems with sockets only)
5494 .It Dv @
5495 Symbolic link (systems with symbolic links only)
5496 .It Dv +
5497 Hidden directory (AIX only) or context dependent (HP/UX only)
5498 .It Dv :
5499 Network special (HP/UX only)
5500 .El
5501 .Pp
5502 If the
5503 .Va listlinks
5504 shell variable is set, symbolic links are identified
5505 in more detail (on only systems that have them, of course):
5506 .Pp
5507 .PD 0
5508 .TP 4
5509 @
5510 Symbolic link to a non-directory
5511 .TP 4
5512 >
5513 Symbolic link to a directory
5514 .TP 4
5515 &
5516 Symbolic link to nowhere
5517 .PD
5518 .Pp
5519 .Va listlinks
5520 also slows down \fIls\-F\fR and causes partitions holding
5521 files pointed to by symbolic links to be mounted.
5522 .Pp
5523 If the
5524 .Va listflags
5525 shell variable is set to
5526 .Sq x
5527 ,
5528 .Sq a
5529 or
5530 .Sq A
5531 , or any
5532 combination thereof (e.g.,
5533 .Sq xA
5534 ), they are used as flags to \fIls\-F\fR,
5535 making it act like
5536 .Sq ls \-xF
5537 ,
5538 .Sq ls \-Fa
5539 ,
5540 .Sq ls \-FA
5541 or a combination
5542 (e.g.,
5543 .Sq ls \-FxA
5544 ).
5545 On machines where
5546 .Sq ls \-C
5547 is not the default, \fIls\-F\fR acts like
5548 .Sq ls \-CF
5549 ,
5550 unless
5551 .Va listflags
5552 contains an
5553 .Sq x
5554 , in which case it acts like
5555 .Sq ls \-xF
5556 \fIls\-F\fR passes its arguments to
5557 .Va ls
5558 (1) if it is given any switches,
5559 so
5560 .Sq alias ls ls\-F
5561 generally does the right thing.
5562 .Pp
5563 The \fBls\-F\fR builtin can list files using different colors depending on the
5564 filetype or extension.
5565 See the
5566 .Va color
5567 shell variable and the
5568 .Va LS_COLORS
5569 environment variable.
5570 .RE
5571 .Pp
5572 .B migrate \fR[
5573 .Fl
5574 .Va site
5575 ]
5576 .Va pid
5577 |\fB%
5578 .Va jobid
5579 ... (+)
5580 .PD 0
5581 .TP 8
5582 .B migrate \-
5583 .Va site
5584 (+)
5585 The first form migrates the process or job to the site specified or the
5586 default site determined by the system path.
5587 The second form is equivalent to
5588 .Sq migrate \-
5589 .Va site
5590 $$
5591 : it migrates the
5592 current process to the specified site.
5593 Migrating the shell
5594 itself can cause unexpected behavior, because the shell
5595 does not like to lose its tty.
5596 (TCF only)
5597 .PD
5598 .TP 8
5599 .B newgrp \fR[
5600 .Fl \fR]
5601 .Va [group]
5602 (+)
5603 Equivalent to
5604 .Sq exec newgrp
5605 ; see
5606 .Va newgrp
5607 (1).
5608 Available only if the shell was so compiled;
5609 see the
5610 .Va version
5611 shell variable.
5612 .TP 8
5613 .B nice \fR[\fB+
5614 .Va number
5615 ] [
5616 .Va command
5617 ]
5618 Sets the scheduling priority for the shell to
5619 .Va number
5620 , or, without
5621 .Va number
5622 , to 4.
5623 With
5624 .Va command ,
5625 runs
5626 .Va command
5627 at the appropriate
5628 priority.
5629 The greater the
5630 .Va number
5631 , the less cpu
5632 the process gets.
5633 The super-user may specify negative
5634 priority by using
5635 .Sq nice \-number ...
5636 Command is always
5637 executed in a sub-shell, and the restrictions placed on
5638 commands in simple
5639 .Va if
5640 statements apply.
5641 .TP 8
5642 .B nohup \fR[
5643 .Va command
5644 ]
5645 With
5646 .Va command
5647 , runs
5648 .Va command
5649 such that it will ignore hangup signals.
5650 Note that commands may set their own response to hangups, overriding
5651 .Va nohup
5652 Without an argument, causes the non-interactive shell only to
5653 ignore hangups for the remainder of the script.
5654 See also
5655 .Va Signal handling
5656 and the
5657 .Va hup
5658 builtin command.
5659 .TP 8
5660 .B notify \fR[\fB%
5661 .Va job
5662 ...]
5663 Causes the shell to notify the user asynchronously when the status of any
5664 of the specified jobs (or, without %
5665 .Va job
5666 , the current job) changes,
5667 instead of waiting until the next prompt as is usual.
5668 .Va job
5669 may be a number, a string,
5670 .Sq
5671 ,
5672 .Sq %
5673 ,
5674 .Sq +
5675 or
5676 .Sq \-
5677 as described
5678 under
5679 .Va Jobs
5680 See also the
5681 .Va notify
5682 shell variable.
5683 .TP 8
5684 .B onintr \fR[
5685 .Fl \fR|
5686 .Va label
5687 ]
5688 Controls the action of the shell on interrupts.
5689 Without arguments,
5690 restores the default action of the shell on interrupts,
5691 which is to terminate shell scripts or to return to the
5692 terminal command input level.
5693 With
5694 .Sq \-
5695 , causes all interrupts to be ignored.
5696 With
5697 .Va label
5698 , causes the shell to execute a
5699 .Sq goto
5700 .Va label
5701 when an interrupt is received or a child process terminates because it was
5702 interrupted.
5703 .IP "" 8
5704 .Va onintr
5705 is ignored if the shell is running detached and in system
5706 startup files (see
5707 .Va FILES
5708 ), where interrupts are disabled anyway.
5709 .TP 8
5710 .B popd \fR[
5711 .Fl p\fR] [
5712 .Fl l\fR] [
5713 .Fl n\fR|
5714 .Fl v\fR] \fR[\fB+
5715 .Va n
5716 ]
5717 Without arguments, pops the directory stack and returns to the new top directory.
5718 With a number
5719 .Sq +
5720 .Va n
5721 , discards the
5722 .Va n
5723 'th entry in the stack.
5724 .IP "" 8
5725 Finally, all forms of
5726 .Va popd
5727 print the final directory stack,
5728 just like
5729 .Va dirs
5730 The
5731 .Va pushdsilent
5732 shell variable can be set to
5733 prevent this and the
5734 .Fl p\fR flag can be given to override
5735 .Va pushdsilent
5736 The
5737 .Fl l\fR,
5738 .Fl n\fR and
5739 .Fl v\fR flags have the same effect on
5740 .Va popd
5741 as on
5742 .Va dirs
5743 (+)
5744 .TP 8
5745 .B printenv \fR[
5746 .Va name
5747 ] (+)
5748 Prints the names and values of all environment variables or,
5749 with
5750 .Va name
5751 , the value of the environment variable
5752 .Va name
5753 .TP 8
5754 .B pushd \fR[
5755 .Fl p\fR] [
5756 .Fl l\fR] [
5757 .Fl n\fR|
5758 .Fl v\fR] [
5759 .Va name
5760 |\fB+
5761 .Va n
5762 ]
5763 Without arguments, exchanges the top two elements of the directory stack.
5764 If
5765 .Va pushdtohome
5766 is set,
5767 .Va pushd
5768 without arguments does
5769 .Sq pushd ~
5770 ,
5771 like
5772 .Va cd
5773 (+)
5774 With
5775 .Va name
5776 , pushes the current working directory onto the directory
5777 stack and changes to
5778 .Va name
5779 If
5780 .Va name
5781 is
5782 .Sq \-
5783 it is interpreted as the previous working directory
5784 (see
5785 .Va Filename substitution
5786 ).
5787 (+)
5788 If
5789 .Va dunique
5790 is set,
5791 .Va pushd
5792 removes any instances of
5793 .Va name
5794 from the stack before pushing it onto the stack.
5795 (+)
5796 With a number
5797 .Sq +
5798 .Va n
5799 , rotates the
5800 .Va n
5801 th element of the
5802 directory stack around to be the top element and changes to it.
5803 If
5804 .Va dextract
5805 is set, however,
5806 .Sq pushd +
5807 .Va n
5808 extracts the
5809 .Va n
5810 th
5811 directory, pushes it onto the top of the stack and changes to it.
5812 (+)
5813 .IP "" 8
5814 Finally, all forms of
5815 .Va pushd
5816 print the final directory stack,
5817 just like
5818 .Va dirs
5819 The
5820 .Va pushdsilent
5821 shell variable can be set to
5822 prevent this and the
5823 .Fl p\fR flag can be given to override
5824 .Va pushdsilent
5825 The
5826 .Fl l\fR,
5827 .Fl n\fR and
5828 .Fl v\fR flags have the same effect on
5829 .Va pushd
5830 as on
5831 .Va dirs
5832 (+)
5833 .TP 8
5834 .B rehash
5835 Causes the internal hash table of the contents of the
5836 directories in the
5837 .Va path
5838 variable to be recomputed.
5839 This is
5840 needed if the
5841 .Va autorehash
5842 shell variable is not set and new
5843 commands are added to directories in
5844 .Va path
5845 while you are logged
5846 in.
5847 With
5848 .Va autorehash
5849 , a new command will be found
5850 automatically, except in the special case where another command of
5851 the same name which is located in a different directory already
5852 exists in the hash table.
5853 Also flushes the cache of home directories
5854 built by tilde expansion.
5855 .TP 8
5856 .B repeat \fIcount command
5857 The specified
5858 .Va command
5859 ,
5860 which is subject to the same restrictions as the
5861 .Va command
5862 in the one line
5863 .Va if
5864 statement above, is executed
5865 .Va count
5866 times.
5867 I/O redirections occur exactly once, even if
5868 .Va count
5869 is 0.
5870 .TP 8
5871 .B rootnode //
5872 .Va nodename
5873 (+)
5874 Changes the rootnode to //
5875 .Va nodename
5876 , so that
5877 .Sq /
5878 will be interpreted
5879 as
5880 .Sq //
5881 .Va nodename
5882 (Domain/OS only)
5883 .Pp
5884 .B sched \fR(+)
5885 .br
5886 .B sched \fR[
5887 .Va +
5888 ]
5889 .Va hh:mm command
5890 \fR(+)
5891 .PD 0
5892 .TP 8
5893 .B sched \-
5894 .Va n
5895 (+)
5896 The first form prints the scheduled-event list.
5897 The
5898 .Va sched
5899 shell variable may be set to define the format in which
5900 the scheduled-event list is printed.
5901 The second form adds
5902 .Va command
5903 to the scheduled-event list.
5904 For example,
5905 .PD
5906 .RS +8
5907 .IP "" 4
5908 > sched 11:00 echo It\e's eleven o\e'clock.
5909 .Pp
5910 causes the shell to echo
5911 .Sq It's eleven o'clock .
5912 at 11 AM.
5913 The time may be in 12-hour AM/PM format
5914 .IP "" 4
5915 .\" TODO
5916 > sched 5pm set prompt='[%h] It\e's after 5; go home: >'
5917 .Pp
5918 or may be relative to the current time:
5919 .IP "" 4
5920 > sched +2:15 /usr/lib/uucp/uucico \-r1 \-sother
5921 .Pp
5922 A relative time specification may not use AM/PM format.
5923 The third form removes item
5924 .Va n
5925 from the event list:
5926 .Bd -literal -offset indent
5927 > sched
5928         1  Wed Apr  4 15:42  /usr/lib/uucp/uucico \-r1 \-sother
5929         2  Wed Apr  4 17:00  set prompt=[%h] It's after 5; go home: >
5930 > sched \-2
5931 > sched
5932         1  Wed Apr  4 15:42  /usr/lib/uucp/uucico \-r1 \-sother
5933 .Ed
5934 .Pp
5935 A command in the scheduled-event list is executed just before the first
5936 prompt is printed after the time when the command is scheduled.
5937 It is possible to miss the exact time when the command is to be run, but
5938 an overdue command will execute at the next prompt.
5939 A command which comes due while the shell
5940 is waiting for user input is executed immediately.
5941 However, normal operation of an already-running command will not
5942 be interrupted so that a scheduled-event list element may be run.
5943 .Pp
5944 This mechanism is similar to, but not the same as, the
5945 .Va at
5946 (1)
5947 command on some Unix systems.
5948 Its major disadvantage is that it may not run a command at exactly the
5949 specified time.
5950 Its major advantage is that because
5951 .Va sched
5952 runs directly from
5953 the shell, it has access to shell variables and other structures.
5954 This provides a mechanism for changing one's working environment
5955 based on the time of day.
5956 .RE
5957 .Pp
5958 .B set
5959 .br
5960 .B set
5961 .Va name
5962 ...
5963 .br
5964 .B set
5965 .Va name
5966 \fB=
5967 .Va word
5968 ...
5969 .br
5970 .B set [\-r] [\-f|\-l]
5971 .Va name
5972 \fB=(\fIwordlist
5973 .Va )
5974 ... (+)
5975 .br
5976 .B set
5977 .Va name[index]
5978 \fB=
5979 .Va word
5980 ...
5981 .br
5982 .B set \-r \fR(+)
5983 .br
5984 .B set \-r
5985 .Va name
5986 ... (+)
5987 .PD 0
5988 .TP 8
5989 .B set \-r
5990 .Va name
5991 \fB=
5992 .Va word
5993 ... (+)
5994 The first form of the command prints the value of all shell variables.
5995 Variables which contain more than a single word print as a
5996 parenthesized word list.
5997 The second form sets
5998 .Va name
5999 to the null string.
6000 The third form sets
6001 .Va name
6002 to the single
6003 .Va word
6004 The fourth form sets
6005 .Va name
6006 to the list of words in
6007 .Va wordlist
6008 In all cases the value is command and filename expanded.
6009 If
6010 .Fl r\fR is specified, the value is set read-only.
6011 If
6012 .Fl f\fR or
6013 .Fl l\fR are specified, set only unique words keeping their order.
6014 .Fl f\fR prefers the first occurrence of a word, and
6015 .Fl l\fR the last.
6016 The fifth form sets the
6017 .Va index
6018 'th component of
6019 .Va name
6020 to
6021 .Va word
6022 ;
6023 this component must already exist.
6024 The sixth form lists only the names of all shell variables that are read-only.
6025 The seventh form makes
6026 .Va name
6027 read-only, whether or not it has a value.
6028 The eighth form is the same as the third form, but
6029 make
6030 .Va name
6031 read-only at the same time.
6032 .PD
6033 .IP "" 8
6034 These arguments can be repeated to set and/or make read-only multiple variables
6035 in a single set command.
6036 Note, however, that variable expansion
6037 happens for all arguments before any setting occurs.
6038 Note also that
6039 .Sq =
6040 can
6041 be adjacent to both
6042 .Va name
6043 and
6044 .Va word
6045 or separated from both by
6046 whitespace, but cannot be adjacent to only one or the other.
6047 See also the
6048 .Va unset
6049 builtin command.
6050 .TP 8
6051 .B setenv \fR[
6052 .Va name
6053 [
6054 .Va value
6055 ]]
6056 Without arguments, prints the names and values of all environment variables.
6057 Given
6058 .Va name
6059 , sets the environment variable
6060 .Va name
6061 to
6062 .Va value
6063 or, without
6064 .Va value
6065 , to the null string.
6066 .TP 8
6067 .B setpath
6068 .Va path
6069 (+)
6070 Equivalent to
6071 .Va setpath
6072 (1).
6073 (Mach only)
6074 .TP 8
6075 .B setspath\fR LOCAL|
6076 .Va site
6077 |
6078 .Va cpu
6079 ...
6080 (+)
6081 Sets the system execution path.
6082 (TCF only)
6083 .TP 8
6084 .B settc
6085 .Va cap value
6086 (+)
6087 Tells the shell to believe that the terminal capability
6088 .Va cap
6089 (as defined in
6090 .Va termcap
6091 (5)) has the value
6092 .Va value
6093 No sanity checking is done.
6094 Concept terminal users may have to
6095 .Sq settc xn no
6096 to get proper
6097 wrapping at the rightmost column.
6098 .TP 8
6099 .B setty \fR[
6100 .Fl d\fR|
6101 .Fl q\fR|
6102 .Fl x\fR] [
6103 .Fl a\fR] [[
6104 .Va +
6105 |
6106 .Fl \fR]
6107 .Va mode
6108 ] (+)
6109 Controls which tty modes (see
6110 .Va Terminal management
6111 )
6112 the shell does not allow to change.
6113 .Fl d\fR,
6114 .Fl q\fR or
6115 .Fl x\fR tells
6116 .Va setty
6117 to act
6118 on the
6119 .Sq edit
6120 ,
6121 .Sq quote
6122 or
6123 .Sq execute
6124 set of tty modes respectively; without
6125 .Fl d\fR,
6126 .Fl q\fR or
6127 .Fl x\fR,
6128 .Sq execute
6129 is used.
6130 .IP "" 8
6131 Without other arguments,
6132 .Va setty
6133 lists the modes in the chosen set
6134 which are fixed on (`+mode') or off (`\-mode').
6135 The available modes, and thus the display, vary from system to system.
6136 With
6137 .Fl a\fR, lists all tty modes in the chosen set
6138 whether or not they are fixed.
6139 With \fB+
6140 .Va mode
6141 ,
6142 .Fl
6143 .Va mode
6144 or
6145 .Va mode
6146 , fixes
6147 .Va mode
6148 on or off
6149 or removes control from
6150 .Va mode
6151 in the chosen set.
6152 For example,
6153 .Sq setty +echok echoe
6154 fixes
6155 .Sq echok
6156 mode on and allows commands
6157 to turn
6158 .Sq echoe
6159 mode on or off, both when the shell is executing commands.
6160 .TP 8
6161 .B setxvers\fR [
6162 .Va string
6163 ] (+)
6164 Set the experimental version prefix to
6165 .Va string
6166 , or removes it
6167 if
6168 .Va string
6169 is omitted.
6170 (TCF only)
6171 .TP 8
6172 .B shift \fR[
6173 .Va variable
6174 ]
6175 Without arguments, discards
6176 .Va argv
6177 [1] and shifts the members of
6178 .Va argv
6179 to the left.
6180 It is an error for
6181 .Va argv
6182 not to be set or to have
6183 less than one word as value.
6184 With
6185 .Va variable
6186 , performs the
6187 same function on
6188 .Va variable
6189 .TP 8
6190 .B source \fR[
6191 .Fl h\fR]
6192 .Va name
6193 [
6194 .Va args
6195 ...]
6196 The shell reads and executes commands from
6197 .Va name
6198 The commands are not placed on the history list.
6199 If any
6200 .Va args
6201 are given, they are placed in
6202 .Va argv
6203 (+)
6204 .Va source
6205 commands may be nested;
6206 if they are nested too deeply the shell may run out of file descriptors.
6207 An error in a
6208 .Va source
6209 at any level terminates all nested
6210 .Va source
6211 commands.
6212 With
6213 .Fl h\fR, commands are placed on the history list instead of being
6214 executed, much like
6215 .Sq history \-L
6216 .TP 8
6217 .B stop \fB%
6218 .Va job
6219 |
6220 .Va pid
6221 ...
6222 Stops the specified jobs or processes which are executing in the background.
6223 .Va job
6224 may be a number, a string,
6225 .Sq
6226 ,
6227 .Sq %
6228 ,
6229 .Sq +
6230 or
6231 .Sq \-
6232 as described
6233 under
6234 .Va Jobs
6235 There is no default
6236 .Va job
6237 ; saying just
6238 .Sq stop
6239 does not stop
6240 the current job.
6241 .TP 8
6242 .B suspend
6243 Causes the shell to stop in its tracks, much as if it had
6244 been sent a stop signal with
6245 .Va ^Z
6246 This is most often used to
6247 stop shells started by
6248 .Va su
6249 (1).
6250 .Pp
6251 .B switch (\fIstring\fB)
6252 .br
6253 .B case \fIstr1\fB:
6254 .PD 0
6255 .IP "" 4
6256 \&...
6257 .br
6258 .B breaksw
6259 .Pp
6260 \&...
6261 .Pp
6262 .B default:
6263 .IP "" 4
6264 \&...
6265 .br
6266 .B breaksw
6267 .TP 8
6268 .B endsw
6269 Each case label is successively matched, against the
6270 specified
6271 .Va string
6272 which is first command and filename expanded.
6273 The file metacharacters
6274 .Sq *
6275 ,
6276 .Sq \&?
6277 and
6278 .Sq [...]
6279 may be used
6280 in the case labels, which are variable expanded.
6281 If none
6282 of the labels match before a
6283 .Sq default
6284 label is found, then
6285 the execution begins after the default label.
6286 Each case
6287 label and the default label must appear at the beginning of
6288 a line.
6289 The command
6290 .Va breaksw
6291 causes execution to continue
6292 after the
6293 .Va endsw
6294 Otherwise control may fall through case
6295 labels and default labels as in C.
6296 If no label matches and
6297 there is no default, execution continues after the
6298 .Va endsw
6299 .PD
6300 .TP 8
6301 .B telltc \fR(+)
6302 Lists the values of all terminal capabilities (see
6303 .Va termcap
6304 (5)).
6305 .TP 8
6306 .B termname \fR[
6307 .Va terminal type
6308 ] \fR(+)
6309 Tests if
6310 .Va terminal type
6311 (or the current value of
6312 .Va TERM
6313 if no
6314 .Va terminal type
6315 is given) has an entry in the hosts termcap(5) or
6316 terminfo(5) database. Prints the terminal type to stdout and returns 0
6317 if an entry is present otherwise returns 1.
6318 .TP 8
6319 .B time \fR[
6320 .Va command
6321 ]
6322 Executes
6323 .Va command
6324 (which must be a simple command, not an alias,
6325 a pipeline, a command list or a parenthesized command list)
6326 and prints a time summary as described under the
6327 .Va time
6328 variable.
6329 If necessary, an extra shell is created to print the time statistic when
6330 the command completes.
6331 Without
6332 .Va command
6333 , prints a time summary for the current shell and its
6334 children.
6335 .TP 8
6336 .B umask \fR[
6337 .Va value
6338 ]
6339 Sets the file creation mask to
6340 .Va value
6341 , which is given in octal.
6342 Common values for the mask are
6343 002, giving all access to the group and read and execute access to others, and
6344 022, giving read and execute access to the group and others.
6345 Without
6346 .Va value
6347 , prints the current file creation mask.
6348 .TP 8
6349 .B unalias
6350 .Va pattern
6351 .br
6352 Removes all aliases whose names match
6353 .Va pattern
6354 `unalias *' thus removes all aliases.
6355 It is not an error for nothing to be
6356 .Va unalias
6357 ed.
6358 .TP 8
6359 .B uncomplete
6360 .Va pattern
6361 (+)
6362 Removes all completions whose names match
6363 .Va pattern
6364 `uncomplete *' thus removes all completions.
6365 It is not an error for nothing to be
6366 .Va uncomplete
6367 d.
6368 .TP 8
6369 .B unhash
6370 Disables use of the internal hash table to speed location of
6371 executed programs.
6372 .TP 8
6373 .B universe
6374 .Va universe
6375 (+)
6376 Sets the universe to
6377 .Va universe
6378 (Masscomp/RTU only)
6379 .TP 8
6380 .B unlimit \fR[
6381 .Fl hf\fR] [
6382 .Va resource
6383 ]
6384 Removes the limitation on
6385 .Va resource
6386 or, if no
6387 .Va resource
6388 is
6389 specified, all
6390 .Va resource
6391 limitations.
6392 With
6393 .Fl h\fR, the corresponding hard limits are removed.
6394 Only the super-user may do this.
6395 Note that
6396 .Va unlimit
6397 may not exit successful, since most systems
6398 do not allow
6399 .Va descriptors
6400 to be unlimited.
6401 With
6402 .Fl f\fR errors are ignored.
6403 .TP 8
6404 .B unset \fIpattern
6405 Removes all variables whose names match
6406 .Va pattern
6407 , unless they are read-only.
6408 `unset *' thus removes all variables unless they are read-only;
6409 this is a bad idea.
6410 It is not an error for nothing to be
6411 .Va unset
6412 .TP 8
6413 .B unsetenv \fIpattern
6414 Removes all environment variables whose names match
6415 .Va pattern
6416 `unsetenv *' thus removes all environment variables;
6417 this is a bad idea.
6418 It is not an error for nothing to be
6419 .Va unsetenv
6420 ed.
6421 .TP 8
6422 .B ver \fR[
6423 .Va systype
6424 [
6425 .Va command
6426 ]] (+)
6427 Without arguments, prints
6428 .Va SYSTYPE
6429 With
6430 .Va systype
6431 , sets
6432 .Va SYSTYPE
6433 to
6434 .Va systype
6435 With
6436 .Va systype
6437 and
6438 .Va command
6439 , executes
6440 .Va command
6441 under
6442 .Va systype
6443 .Va systype
6444 may be
6445 .Sq bsd4.3
6446 or
6447 .Sq sys5.3
6448 (Domain/OS only)
6449 .TP 8
6450 .B wait
6451 The shell waits for all background jobs.
6452 If the shell is interactive, an
6453 interrupt will disrupt the wait and cause the shell to print the names and job
6454 numbers of all outstanding jobs.
6455 .TP 8
6456 .B warp
6457 .Va universe
6458 (+)
6459 Sets the universe to
6460 .Va universe
6461 (Convex/OS only)
6462 .TP 8
6463 .B watchlog \fR(+)
6464 An alternate name for the
6465 .Va log
6466 builtin command (q.v.).
6467 Available only if the shell was so compiled;
6468 see the
6469 .Va version
6470 shell variable.
6471 .TP 8
6472 .B where
6473 .Va command
6474 (+)
6475 Reports all known instances of
6476 .Va command
6477 , including aliases, builtins and
6478 executables in
6479 .Va path
6480 .TP 8
6481 .B which\fR
6482 .Va command
6483 (+)
6484 Displays the command that will be executed by the shell after substitutions,
6485 .Va path
6486 searching, etc.
6487 The builtin command is just like
6488 .Va which
6489 (1), but it correctly reports
6490 .Nm
6491 aliases and builtins and is 10 to 100 times faster.
6492 See also the
6493 .Va which-command
6494 editor command.
6495 .Pp
6496 .B while (\fIexpr
6497 .Va )
6498 .br
6499 \&...
6500 .PD 0
6501 .TP 8
6502 .B end
6503 Executes the commands between the
6504 .Va while
6505 and the matching
6506 .Va end
6507 while
6508 .Va expr
6509 (an expression, as described under
6510 .Va Expressions
6511 )
6512 evaluates non-zero.
6513 .Va while
6514 and
6515 .Va end
6516 must appear alone on their input lines.
6517 .Va break
6518 and
6519 .Va continue
6520 may be used to terminate or continue the
6521 loop prematurely.
6522 If the input is a terminal, the user is prompted the first time
6523 through the loop as with
6524 .Va foreach
6525 .PD
6526 .Ss "Special aliases (+)"
6527 If set, each of these aliases executes automatically at the indicated time.
6528 They are all initially undefined.
6529 .TP 8
6530 .B beepcmd
6531 Runs when the shell wants to ring the terminal bell.
6532 .TP 8
6533 .B cwdcmd
6534 Runs after every change of working directory.
6535 For example, if the user is
6536 working on an X window system using
6537 .Va xterm
6538 (1) and a re-parenting window
6539 manager that supports title bars such as
6540 .Va twm
6541 (1) and does
6542 .RS +8
6543 .IP "" 4
6544 > alias cwdcmd  'echo \-n "^[]2;${HOST}:$cwd ^G"'
6545 .Pp
6546 then the shell will change the title of the running
6547 .Va xterm
6548 (1)
6549 to be the name of the host, a colon, and the full current working directory.
6550 A fancier way to do that is
6551 .IP "" 4
6552 > alias cwdcmd 'echo \-n "^[]2;${HOST}:$cwd^G^[]1;${HOST}^G"'
6553 .Pp
6554 This will put the hostname and working directory on the title bar but
6555 only the hostname in the icon manager menu.
6556 .Pp
6557 Note that putting a
6558 .Va cd
6559 ,
6560 .Va pushd
6561 or
6562 .Va popd
6563 in
6564 .Va cwdcmd
6565 may cause an infinite loop.
6566 It is the author's opinion that anyone doing
6567 so will get what they deserve.
6568 .RE
6569 .TP 8
6570 .B jobcmd
6571 Runs before each command gets executed, or when the command changes state.
6572 This is similar to
6573 .Va postcmd
6574 , but it does not print builtins.
6575 .RS +8
6576 .IP "" 4
6577 > alias jobcmd  'echo \-n "^[]2\e;\e!#:q^G"'
6578 .Pp
6579 then executing
6580 .Va vi foo.c
6581 will put the command string in the xterm title bar.
6582 .RE
6583 .TP 8
6584 .B helpcommand
6585 Invoked by the
6586 .Va run-help
6587 editor command.
6588 The command name for which help
6589 is sought is passed as sole argument.
6590 For example, if one does
6591 .RS +8
6592 .IP "" 4
6593 > alias helpcommand '\e!:1 --help'
6594 .Pp
6595 then the help display of the command itself will be invoked, using the GNU
6596 help calling convention.
6597 Currently there is no easy way to account for various calling conventions (e.g.,
6598 the customary Unix
6599 .Sq -h
6600 ), except by using a table of many commands.
6601 .RE
6602 .TP 8
6603 .B periodic
6604 Runs every
6605 .Va tperiod
6606 minutes.
6607 This provides a convenient means for
6608 checking on common but infrequent changes such as new mail.
6609 For example,
6610 if one does
6611 .RS +8
6612 .IP "" 4
6613 > set tperiod = 30
6614 .br
6615 > alias periodic checknews
6616 .Pp
6617 then the
6618 .Va checknews
6619 (1) program runs every 30 minutes.
6620 If
6621 .Va periodic
6622 is set but
6623 .Va tperiod
6624 is unset or set to 0,
6625 .Va periodic
6626 behaves like
6627 .Va precmd
6628 .RE
6629 .TP 8
6630 .B precmd
6631 Runs just before each prompt is printed.
6632 For example, if one does
6633 .RS +8
6634 .IP "" 4
6635 > alias precmd date
6636 .Pp
6637 then
6638 .Va date
6639 (1) runs just before the shell prompts for each command.
6640 There are no limits on what
6641 .Va precmd
6642 can be set to do, but discretion
6643 should be used.
6644 .RE
6645 .TP 8
6646 .B postcmd
6647 Runs before each command gets executed.
6648 .RS +8
6649 .IP "" 4
6650 > alias postcmd  'echo \-n "^[]2\e;\e!#:q^G"'
6651 .Pp
6652 then executing
6653 .Va vi foo.c
6654 will put the command string in the xterm title bar.
6655 .RE
6656 .TP 8
6657 .B shell
6658 Specifies the interpreter for executable scripts which do not themselves
6659 specify an interpreter.
6660 The first word should be a full path name to the
6661 desired interpreter (e.g.,
6662 .Sq /bin/csh
6663 or
6664 .Sq /usr/local/bin/tcsh
6665 ).
6666 .Ss "Special shell variables"
6667 The variables described in this section have special meaning to the shell.
6668 .Pp
6669 The shell sets
6670 .Va addsuffix ,
6671 .Va argv ,
6672 .Va autologout ,
6673 .Va csubstnonl ,
6674 .Va command ,
6675 .Va echo_style ,
6676 .Va edit ,
6677 .Va gid ,
6678 .Va group ,
6679 .Va home ,
6680 .Va loginsh ,
6681 .Va oid ,
6682 .Va path ,
6683 .Va prompt ,
6684 .Va prompt2 ,
6685 .Va prompt3 ,
6686 .Va shell ,
6687 .Va shlvl ,
6688 .Va tcsh ,
6689 .Va term ,
6690 .Va tty ,
6691 .Va uid ,
6692 .Va user
6693 and
6694 .Va version
6695 at
6696 startup; they do not change thereafter unless changed by the user.
6697 The shell updates
6698 .Va cwd ,
6699 .Va dirstack ,
6700 .Va owd
6701 and
6702 .Va status
6703 when necessary,
6704 and sets
6705 .Va logout
6706 on logout.
6707 .Pp
6708 The shell synchronizes
6709 .Va group ,
6710 .Va home ,
6711 .Va path ,
6712 .Va shlvl ,
6713 .Va term and
6714 .Va user
6715 with the environment variables of the same names:
6716 whenever the environment variable changes the shell changes the corresponding
6717 shell variable to match (unless the shell variable is read-only) and vice
6718 versa.
6719 Note that although
6720 .Va cwd
6721 and
6722 .Va PWD
6723 have identical meanings, they
6724 are not synchronized in this manner, and that the shell automatically
6725 converts between the different formats of
6726 .Va path
6727 and
6728 .Va PATH
6729 .TP 8
6730 .B addsuffix \fR(+)
6731 If set, filename completion adds
6732 .Sq /
6733 to the end of directories and a space
6734 to the end of normal files when they are matched exactly.
6735 Set by default.
6736 .TP 8
6737 .B afsuser \fR(+)
6738 If set,
6739 .Va autologout
6740 's autolock feature uses its value instead of
6741 the local username for kerberos authentication.
6742 .TP 8
6743 .B ampm \fR(+)
6744 If set, all times are shown in 12-hour AM/PM format.
6745 .TP 8
6746 .B anyerror \fR(+)
6747 This variable selects what is propagated to the value of the
6748 .Va status
6749 variable. For more information see the description of the
6750 .Va status
6751 variable below.
6752 .TP 8
6753 .B argv
6754 The arguments to the shell.
6755 Positional parameters are taken from
6756 .Va argv
6757 ,
6758 i.e.,
6759 .Sq $1
6760 is replaced by
6761 .Sq $argv[1]
6762 , etc.
6763 Set by default, but usually empty in interactive shells.
6764 .TP 8
6765 .B autocorrect \fR(+)
6766 If set, the
6767 .Va spell-word
6768 editor command is invoked automatically before
6769 each completion attempt.
6770 .TP 8
6771 .B autoexpand \fR(+)
6772 If set, the
6773 .Va expand-history
6774 editor command is invoked automatically
6775 before each completion attempt. If this is set to
6776 .Va onlyhistory
6777 , then
6778 only history will be expanded and a second completion will expand filenames.
6779 .TP 8
6780 .B autolist \fR(+)
6781 If set, possibilities are listed after an ambiguous completion.
6782 If set to
6783 .Sq ambiguous
6784 , possibilities are listed only when no new
6785 characters are added by completion.
6786 .TP 8
6787 .B autologout \fR(+)
6788 The first word is the number of minutes of inactivity before automatic
6789 logout.
6790 The optional second word is the number of minutes of inactivity
6791 before automatic locking.
6792 When the shell automatically logs out, it prints
6793 .Sq auto-logout
6794 , sets the
6795 variable
6796 .Va logout
6797 to
6798 .Sq automatic
6799 and exits.
6800 When the shell automatically locks, the user is required to enter his password
6801 to continue working.
6802 Five incorrect attempts result in automatic logout.
6803 Set to
6804 .Sq 60
6805 (automatic logout after 60 minutes, and no locking) by default
6806 in login and superuser shells, but not if the shell thinks it is running
6807 under a window system (i.e., the
6808 .Va DISPLAY
6809 environment variable is set),
6810 the tty is a pseudo-tty (pty) or the shell was not so compiled (see the
6811 .Va version
6812 shell variable).
6813 See also the
6814 .Va afsuser
6815 and
6816 .Va logout
6817 shell variables.
6818 .TP 8
6819 .B autorehash \fR(+)
6820 If set, the internal hash table of the contents of the directories in the
6821 .Va path
6822 variable will be recomputed if a command is not found in the hash
6823 table.
6824 In addition, the list of available commands will be rebuilt for each
6825 command completion or spelling correction attempt if set to
6826 .Sq complete
6827 or
6828 `correct' respectively; if set to
6829 .Sq always
6830 , this will be done for both
6831 cases.
6832 .TP 8
6833 .B backslash_quote \fR(+)
6834 .\" TODO
6835 If set, backslashes (`\e') always quote
6836 .Sq \e
6837 ,
6838 .Sq \&' ,
6839 and
6840 .Sq \&"
6841 This may make
6842 complex quoting tasks easier, but it can cause syntax errors in
6843 .Xr csh 1
6844 scripts.
6845 .TP 8
6846 .B catalog
6847 The file name of the message catalog.
6848 If set, tcsh use
6849 .Sq tcsh.${catalog}
6850 as a message catalog instead of
6851 default
6852 .Sq tcsh
6853 .TP 8
6854 .B cdpath
6855 A list of directories in which
6856 .Va cd
6857 should search for
6858 subdirectories if they aren't found in the current directory.
6859 .TP 8
6860 .B cdtohome \fR(+)
6861 If not set,
6862 .Va cd
6863 requires a directory
6864 .Va name
6865 , and will not go to the
6866 .Va home
6867 directory if it's omitted.
6868 This is set by default.
6869 .TP 8
6870 .B color
6871 If set, it enables color display for the builtin \fBls\-F\fR and it passes
6872 .Fl \-color=auto\fR to
6873 .Va ls
6874 Alternatively, it can be set to only
6875 \fBls\-F\fR or only
6876 .Va ls
6877 to enable color to only one command.
6878 Setting
6879 it to nothing is equivalent to setting it to \fB(ls\-F ls)\fR.
6880 .TP 8
6881 .B colorcat
6882 If set, it enables color escape sequence for NLS message files.
6883 And display colorful NLS messages.
6884 .TP 8
6885 .B command \fR(+)
6886 If set, the command which was passed to the shell with the
6887 .Va -c
6888 flag (q.v.).
6889 .TP 8
6890 .B compat_expr \fR(+)
6891 If set, the shell will evaluate expressions right to left, like the original
6892 .Xr csh 1
6893 .TP 8
6894 .B complete \fR(+)
6895 If set to
6896 .Sq igncase
6897 , the completion becomes case insensitive.
6898 If set to
6899 .Sq enhance
6900 , completion ignores case and considers
6901 hyphens and underscores to be equivalent; it will also treat
6902 periods, hyphens and underscores (`.',
6903 .Sq \-
6904 and
6905 .Sq _
6906 ) as word
6907 separators.
6908 If set to
6909 .Sq Enhance
6910 , completion matches uppercase and underscore
6911 characters explicitly and matches lowercase and hyphens in a
6912 case-insensitive manner; it will treat periods, hyphens and underscores
6913 as word separators.
6914 .TP 8
6915 .B continue \fR(+)
6916 If set to a list of commands, the shell will continue the listed
6917 commands, instead of starting a new one.
6918 .TP 8
6919 .B continue_args \fR(+)
6920 Same as continue, but the shell will execute:
6921 .RS +8
6922 .IP "" 4
6923 echo \`pwd\` $argv > ~/.<cmd>_pause; %<cmd>
6924 .RE
6925 .TP 8
6926 .B correct \fR(+)
6927 If set to
6928 .Sq cmd
6929 , commands are automatically spelling-corrected.
6930 If set to
6931 .Sq complete
6932 , commands are automatically completed.
6933 If set to
6934 .Sq all
6935 , the entire command line is corrected.
6936 .TP 8
6937 .B csubstnonl \fR(+)
6938 If set, newlines and carriage returns in command substitution are
6939 replaced by spaces.
6940 Set by default.
6941 .TP 8
6942 .B cwd
6943 The full pathname of the current directory.
6944 See also the
6945 .Va dirstack
6946 and
6947 .Va owd
6948 shell variables.
6949 .TP 8
6950 .B dextract \fR(+)
6951 If set,
6952 .Sq pushd +
6953 .Va n
6954 extracts the
6955 .Va n
6956 th directory from the directory
6957 stack rather than rotating it to the top.
6958 .TP 8
6959 .B dirsfile \fR(+)
6960 The default location in which
6961 .Sq dirs \-S
6962 and
6963 .Sq dirs \-L
6964 look for
6965 a history file.
6966 If unset,
6967 .Va ~/.cshdirs
6968 is used.
6969 Because only
6970 .Va ~/.tcshrc
6971 is normally sourced before
6972 .Va ~/.cshdirs
6973 ,
6974 .Va dirsfile
6975 should be set in
6976 .Va ~/.tcshrc
6977 rather than
6978 .Va ~/.login
6979 .TP 8
6980 .B dirstack \fR(+)
6981 An array of all the directories on the directory stack.
6982 `$dirstack[1]' is the current working directory,
6983 .Sq $dirstack[2]
6984 the first directory on the stack, etc.
6985 Note that the current working directory is
6986 .Sq $dirstack[1]
6987 but
6988 .Sq =0
6989 in
6990 directory stack substitutions, etc.
6991 One can change the stack arbitrarily by setting
6992 .Va dirstack
6993 ,
6994 but the first element (the current working directory) is always correct.
6995 See also the
6996 .Va cwd
6997 and
6998 .Va owd
6999 shell variables.
7000 .TP 8
7001 .B dspmbyte \fR(+)
7002 Has an effect iff 'dspm' is listed as part of the
7003 .Va version
7004 shell variable.
7005 If set to
7006 .Sq euc
7007 , it enables display and editing EUC-kanji(Japanese) code.
7008 If set to
7009 .Sq sjis
7010 , it enables display and editing Shift-JIS(Japanese) code.
7011 If set to
7012 .Sq big5
7013 , it enables display and editing Big5(Chinese) code.
7014 If set to
7015 .Sq utf8
7016 , it enables display and editing Utf8(Unicode) code.
7017 If set to the following format, it enables display and editing of original
7018 multi-byte code format:
7019 .RS +8
7020 .IP "" 4
7021 > set dspmbyte = 0000....(256 bytes)....0000
7022 .Pp
7023 The table requires
7024 .Va just
7025 256 bytes.
7026 Each character of 256 characters
7027 corresponds (from left to right) to the ASCII codes 0x00, 0x01, ... 0xff.
7028 Each
7029 character
7030 .\" (position in this table?)
7031 is set to number 0,1,2 and 3.
7032 Each number has the following meaning:
7033 .br
7034 0 ... not used for multi-byte characters.
7035 .br
7036 1 ... used for the first byte of a multi-byte character.
7037 .br
7038 2 ... used for the second byte of a multi-byte character.
7039 .br
7040 3 ... used for both the first byte and second byte of a multi-byte character.
7041 .\" SHK: I tried my best to get the following to be grammatically correct.
7042 .\" However, I still don't understand what's going on here.
7043 In the
7044 .\" following example, there are three bytes, but the text seems to refer to
7045 .\" each nybble as a character.
7046 What's going on here?  It this 3-byte code
7047 .\" in the table?  The text above seems to imply that there are 256
7048 .\" characters/bytes in the table.
7049 If I get some more info on this (perhaps
7050 .\" a complete example), I could fix the text to be grammatically correct.
7051 .\" (steve.kelem@xilinx.com 1999/09/13)
7052 .Pp
7053 Example:
7054 .br
7055 If set to
7056 .Sq 001322
7057 , the first character (means 0x00 of the ASCII code) and
7058 second character (means 0x01 of ASCII code) are set to
7059 .Sq 0
7060 Then, it is not
7061 used for multi-byte characters.
7062 The 3rd character (0x02) is set to '1',
7063 indicating that it is used for the first byte of a multi-byte character.
7064 The 4th character(0x03) is set '3'.
7065 It is used for both the first byte and
7066 the second byte of a multi-byte character.
7067 The 5th and 6th characters
7068 (0x04,0x05) are set to '2', indicating that they are used for the second
7069 byte of a multi-byte character.
7070 .Pp
7071 The GNU fileutils version of ls cannot display multi-byte
7072 filenames without the -N ( --literal ) option.
7073 If you are using
7074 this version, set the second word of dspmbyte to "ls".
7075 If not, for
7076 example, "ls-F -l" cannot display multi-byte filenames.
7077 .Pp
7078 Note:
7079 .br
7080 This variable can only be used if KANJI and DSPMBYTE has been defined at
7081 compile time.
7082 .RE
7083 .TP 8
7084 .B dunique \fR(+)
7085 If set,
7086 .Va pushd
7087 removes any instances of
7088 .Va name
7089 from the stack before pushing it onto the stack.
7090 .TP 8
7091 .B echo
7092 If set, each command with its arguments is echoed just before it is
7093 executed.
7094 For non-builtin commands all expansions occur before
7095 echoing.
7096 Builtin commands are echoed before command and filename
7097 substitution, because these substitutions are then done selectively.
7098 Set by the
7099 .Fl x\fR command line option.
7100 .TP 8
7101 .B echo_style \fR(+)
7102 The style of the
7103 .Va echo
7104 builtin.
7105 May be set to
7106 .Pp
7107 .RS +8
7108 .PD 0
7109 .TP 8
7110 bsd
7111 Don't echo a newline if the first argument is
7112 .Sq \-n ;
7113 the default for
7114 .Xr csh 1
7115 .TP 8
7116 sysv
7117 Recognize backslashed escape sequences in echo strings.
7118 .TP 8
7119 both
7120 Recognize both the
7121 .Sq \-n
7122 flag and backslashed escape sequences; the default
7123 for
7124 .Nm
7125 .TP 8
7126 none
7127 Recognize neither.
7128 .PD
7129 .Pp
7130 Set by default to the local system default.
7131 The BSD and System V
7132 options are described in the
7133 .Va echo
7134 (1) man pages on the appropriate
7135 systems.
7136 .RE
7137 .TP 8
7138 .B edit \fR(+)
7139 If set, the command-line editor is used.
7140 Set by default in interactive
7141 shells.
7142 .TP 8
7143 .B editors \fR(+)
7144 A list of command names for the
7145 .Va run-fg-editor
7146 editor command to match.
7147 If not set, the
7148 .Va EDITOR
7149 (`ed' if unset) and
7150 .Va VISUAL
7151 (`vi' if unset)
7152 environment variables will be used instead.
7153 .TP 8
7154 .B ellipsis \fR(+)
7155 If set, the
7156 .Sq %c
7157 /`%.' and
7158 .Sq %C
7159 prompt sequences (see the
7160 .Va prompt
7161 shell variable) indicate skipped directories with an ellipsis (`...')
7162 instead of
7163 .Sq /<skipped>
7164 .TP 8
7165 .B euid \fR(+)
7166 The user's effective user ID.
7167 .TP 8
7168 .B euser \fR(+)
7169 The first matching passwd entry name corresponding to the effective user ID.
7170 .TP 8
7171 .B fignore \fR(+)
7172 Lists file name suffixes to be ignored by completion.
7173 .TP 8
7174 .B filec
7175 In
7176 .Nm
7177 , completion is always used and this variable is ignored
7178 by default. If
7179 .B edit
7180 is unset, then the traditional
7181 .Xr csh 1
7182 completion is used.
7183 If set in
7184 .Xr csh 1
7185 , filename completion is used.
7186 .TP 8
7187 .B gid \fR(+)
7188 The user's real group ID.
7189 .TP 8
7190 .B globdot \fR(+)
7191 If set, wild-card glob patterns will match files and directories beginning
7192 with
7193 .Sq .
7194 except for
7195 .Sq .
7196 and
7197 .Sq ..
7198 .TP 8
7199 .B globstar \fR(+)
7200 If set, the
7201 .Sq **
7202 and
7203 .Sq ***
7204 file glob patterns will match any string of
7205 characters including
7206 .Sq /
7207 traversing any existing sub-directories.
7208 (e.g.
7209 `ls **.c' will list all the .c files in the current directory tree).
7210 If used by itself, it will match zero or more sub-directories
7211 (e.g.
7212 .Sq ls /usr/include/**/time.h
7213 will list any file named
7214 .Sq time.h
7215 in the /usr/include directory tree; whereas
7216 .Sq ls /usr/include/**time.h
7217 will match any file in the /usr/include directory tree ending in
7218 .Sq time.h
7219 ).
7220 To prevent problems with recursion, the
7221 .Sq **
7222 glob-pattern will not
7223 descend into a symbolic link containing a directory.
7224 To override this,
7225 use
7226 .Sq ***
7227 .TP 8
7228 .B group \fR(+)
7229 The user's group name.
7230 .TP 8
7231 .B highlight
7232 If set, the incremental search match (in
7233 .Va i-search-back
7234 and
7235 .Va i-search-fwd
7236 ) and the region between the mark and the cursor are
7237 highlighted in reverse video.
7238 .IP "" 8
7239 Highlighting requires more frequent terminal writes, which introduces extra
7240 overhead. If you care about terminal performance, you may want to leave this
7241 unset.
7242 .TP 8
7243 .B histchars
7244 A string value determining the characters used in \fBHistory
7245 substitution\fR (q.v.).
7246 The first character of its value is used as
7247 the history substitution character, replacing the default character
7248 `!'.
7249 The second character of its value replaces the character
7250 .Sq ^
7251 in
7252 quick substitutions.
7253 .TP 8
7254 .B histdup \fR(+)
7255 Controls handling of duplicate entries in the history list.
7256 If set to
7257 `all' only unique history events are entered in the history list.
7258 If
7259 set to
7260 .Sq prev
7261 and the last history event is the same as the current
7262 command, then the current command is not entered in the history.
7263 If
7264 set to
7265 .Sq erase
7266 and the same event is found in the history list, that
7267 old event gets erased and the current one gets inserted.
7268 Note that the
7269 `prev' and
7270 .Sq all
7271 options renumber history events so there are no gaps.
7272 .TP 8
7273 .B histfile \fR(+)
7274 The default location in which
7275 .Sq history \-S
7276 and
7277 .Sq history \-L
7278 look for
7279 a history file.
7280 If unset,
7281 .Va ~/.history
7282 is used.
7283 .Va histfile
7284 is
7285 useful when sharing the same home directory between different machines,
7286 or when saving separate histories on different terminals.
7287 Because only
7288 .Va ~/.tcshrc
7289 is normally sourced before
7290 .Va ~/.history
7291 ,
7292 .Va histfile
7293 should be set in
7294 .Va ~/.tcshrc
7295 rather than
7296 .Va ~/.login
7297 .TP 8
7298 .B histlit \fR(+)
7299 If set, builtin and editor commands and the
7300 .Va savehist
7301 mechanism
7302 use the literal (unexpanded) form of lines in the history list.
7303 See
7304 also the
7305 .Va toggle-literal-history
7306 editor command.
7307 .TP 8
7308 .B history
7309 The first word indicates the number of history events to save.
7310 The
7311 optional second word (+) indicates the format in which history is
7312 printed; if not given,
7313 .Sq %h\et%T\et%R\en
7314 is used.
7315 The format sequences
7316 are described below under
7317 .Va prompt
7318 ; note the variable meaning of
7319 `%R'.
7320 Set to
7321 .Sq 100
7322 by default.
7323 .TP 8
7324 .B home
7325 Initialized to the home directory of the invoker.
7326 The filename
7327 expansion of
7328 .Sq
7329 .Va ~
7330 refers to this variable.
7331 .TP 8
7332 .B ignoreeof
7333 If set to the empty string or
7334 .Sq 0
7335 and the input device is a terminal,
7336 the
7337 .Va end-of-file
7338 command (usually generated by the user by typing
7339 `^D' on an empty line) causes the shell to print `Use "exit" to leave
7340 tcsh.' instead of exiting.
7341 This prevents the shell from accidentally
7342 being killed.
7343 Historically this setting exited after 26 successive
7344 EOF's to avoid infinite loops.
7345 If set to a number
7346 .Va n
7347 , the shell
7348 ignores
7349 .Va n - 1
7350 consecutive
7351 .Va end-of-file
7352 s and exits on the
7353 .Va n
7354 th.
7355 (+) If unset,
7356 .Sq 1
7357 is used, i.e., the shell exits on a
7358 single
7359 .Sq ^D
7360 .TP 8
7361 .B implicitcd \fR(+)
7362 If set, the shell treats a directory name typed as a command as though
7363 it were a request to change to that directory.
7364 If set to
7365 .Va verbose
7366 ,
7367 the change of directory is echoed to the standard output.
7368 This behavior
7369 is inhibited in non-interactive shell scripts, or for command strings
7370 with more than one word.
7371 Changing directory takes precedence over
7372 executing a like-named command, but it is done after alias
7373 substitutions.
7374 Tilde and variable expansions work as expected.
7375 .TP 8
7376 .B inputmode \fR(+)
7377 If set to
7378 .Sq insert
7379 or
7380 .Sq overwrite
7381 , puts the editor into that input mode
7382 at the beginning of each line.
7383 .TP 8
7384 .B killdup \fR(+)
7385 Controls handling of duplicate entries in the kill ring.
7386 If set to
7387 `all' only unique strings are entered in the kill ring.
7388 If set to
7389 `prev' and the last killed string is the same as the current killed
7390 string, then the current string is not entered in the ring.
7391 If set
7392 to
7393 .Sq erase
7394 and the same string is found in the kill ring, the old
7395 string is erased and the current one is inserted.
7396 .TP 8
7397 .B killring \fR(+)
7398 Indicates the number of killed strings to keep in memory.
7399 Set to
7400 .Sq 30
7401 by default.
7402 If unset or set to less than
7403 .Sq 2
7404 , the shell will only
7405 keep the most recently killed string.
7406 Strings are put in the killring by the editor commands that delete
7407 (kill) strings of text, e.g.
7408 .Va backward-delete-word
7409 ,
7410 .Va kill-line
7411 , etc, as well as the
7412 .Va copy-region-as-kill
7413 command.
7414 The
7415 .Va yank
7416 editor command will yank the most recently killed string
7417 into the command-line, while
7418 .Va yank-pop
7419 (see
7420 .Va Editor commands
7421 )
7422 can be used to yank earlier killed strings.
7423 .TP 8
7424 .B listflags \fR(+)
7425 If set to
7426 .Sq x
7427 ,
7428 .Sq a
7429 or
7430 .Sq A
7431 , or any combination thereof (e.g.,
7432 .Sq xA
7433 ), they
7434 are used as flags to \fIls\-F\fR, making it act like
7435 .Sq ls \-xF
7436 , `ls
7437 \-Fa',
7438 .Sq ls \-FA
7439 or a combination (e.g.,
7440 .Sq ls \-FxA
7441 ):
7442 .Sq a
7443 shows all
7444 files (even if they start with a
7445 .Sq .
7446 ),
7447 .Sq A
7448 shows all files but
7449 .Sq .
7450 and
7451 `..', and
7452 .Sq x
7453 sorts across instead of down.
7454 If the second word of
7455 .Va listflags
7456 is set, it is used as the path to
7457 .Sq ls(1)
7458 .TP 8
7459 .B listjobs \fR(+)
7460 If set, all jobs are listed when a job is suspended.
7461 If set to
7462 .Sq long
7463 ,
7464 the listing is in long format.
7465 .TP 8
7466 .B listlinks \fR(+)
7467 If set, the \fIls\-F\fR builtin command shows the type of file to which
7468 each symbolic link points.
7469 .TP 8
7470 .B listmax \fR(+)
7471 The maximum number of items which the
7472 .Va list-choices
7473 editor command
7474 will list without asking first.
7475 .TP 8
7476 .B listmaxrows \fR(+)
7477 The maximum number of rows of items which the
7478 .Va list-choices
7479 editor
7480 command will list without asking first.
7481 .TP 8
7482 .B loginsh \fR(+)
7483 Set by the shell if it is a login shell.
7484 Setting or unsetting it
7485 within a shell has no effect.
7486 See also
7487 .Va shlvl
7488 .TP 8
7489 .B logout \fR(+)
7490 Set by the shell to
7491 .Sq normal
7492 before a normal logout,
7493 .Sq automatic
7494 before
7495 an automatic logout, and
7496 .Sq hangup
7497 if the shell was killed by a hangup
7498 signal (see
7499 .Va Signal handling
7500 ).
7501 See also the
7502 .Va autologout
7503 shell variable.
7504 .TP 8
7505 .B mail
7506 A list of files and directories to check for incoming mail, optionally
7507 preceded by a numeric word.
7508 Before each prompt, if 10 minutes have
7509 passed since the last check, the shell checks each file and says `You
7510 have new mail.' (or, if
7511 .Va mail
7512 contains multiple files, `You have
7513 new mail in
7514 .Va name
7515 .') if the filesize is greater than zero in size
7516 and has a modification time greater than its access time.
7517 .Pp
7518 .RS +8
7519 .PD
7520 .Pp
7521 If you are in a login shell, then no mail file is reported unless it has
7522 been modified after the time the shell has started up, to prevent
7523 redundant notifications.
7524 Most login programs will tell you whether or not
7525 you have mail when you log in.
7526 .Pp
7527 If a file specified in
7528 .Va mail
7529 is a directory, the shell will count each
7530 file within that directory as a separate message, and will report `You have
7531 .Va n
7532 mails.' or
7533 .Sq You have
7534 .Va n
7535 mails in
7536 .Va name
7537 as appropriate.
7538 This functionality is provided primarily for those systems which store mail
7539 in this manner, such as the Andrew Mail System.
7540 .Pp
7541 If the first word of
7542 .Va mail
7543 is numeric it is taken as a different mail
7544 checking interval, in seconds.
7545 .Pp
7546 Under very rare circumstances, the shell may report
7547 .Sq You have mail.
7548 instead
7549 of
7550 .Sq You have new mail.
7551 .RE
7552 .TP 8
7553 .B matchbeep \fR(+)
7554 If set to
7555 .Sq never
7556 , completion never beeps.
7557 If set to
7558 .Sq nomatch
7559 , it beeps only when there is no match.
7560 If set to
7561 .Sq ambiguous
7562 , it beeps when there are multiple matches.
7563 If set to
7564 .Sq notunique
7565 , it beeps when there is one exact and other longer matches.
7566 If unset,
7567 .Sq ambiguous
7568 is used.
7569 .TP 8
7570 .B nobeep \fR(+)
7571 If set, beeping is completely disabled.
7572 See also
7573 .Va visiblebell
7574 .TP 8
7575 .B noclobber
7576 If set, restrictions are placed on output redirection to insure that files
7577 are not accidentally destroyed and that
7578 .Sq >>
7579 redirections refer to existing
7580 files, as described in the
7581 .Va Input/output
7582 section.
7583 .TP 8
7584 .B noding
7585 If set, disable the printing of
7586 .Sq DING!
7587 in the
7588 .Va prompt
7589 time
7590 specifiers at the change of hour.
7591 .TP 8
7592 .B noglob
7593 If set,
7594 .Va Filename substitution
7595 and
7596 .Va Directory stack substitution
7597 (q.v.) are inhibited.
7598 This is most useful in shell scripts which do not deal
7599 with filenames, or after a list of filenames has been obtained and further
7600 expansions are not desirable.
7601 .TP 8
7602 .B nokanji \fR(+)
7603 If set and the shell supports Kanji (see the
7604 .Va version
7605 shell variable),
7606 it is disabled so that the meta key can be used.
7607 .TP 8
7608 .B nonomatch
7609 If set, a
7610 .Va Filename substitution
7611 or
7612 .Va Directory stack substitution
7613 (q.v.) which does not match any
7614 existing files is left untouched rather than causing an error.
7615 It is still an error for the substitution to be
7616 malformed, e.g.,
7617 .Sq echo [
7618 still gives an error.
7619 .TP 8
7620 .B nostat \fR(+)
7621 A list of directories (or glob-patterns which match directories; see
7622 .Va Filename substitution
7623 ) that should not be
7624 .Va stat
7625 (2)ed during a
7626 completion operation.
7627 This is usually used to exclude directories which
7628 take too much time to
7629 .Va stat
7630 (2), for example
7631 .Va /afs
7632 .TP 8
7633 .B notify
7634 If set, the shell announces job completions asynchronously.
7635 The default is to present job completions just before printing a prompt.
7636 .TP 8
7637 .B oid \fR(+)
7638 The user's real organization ID.
7639 (Domain/OS only)
7640 .TP 8
7641 .B owd \fR(+)
7642 The old working directory, equivalent to the
7643 .Sq \-
7644 used by
7645 .Va cd
7646 and
7647 .Va pushd
7648 See also the
7649 .Va cwd
7650 and
7651 .Va dirstack
7652 shell variables.
7653 .TP 8
7654 .B padhour
7655 If set, enable the printing of padding '0' for hours, in 24 and 12 hour
7656 formats.
7657 E.G.: 07:45:42 vs. 7:45:42.
7658 .TP 8
7659 .B parseoctal
7660 To retain compatibily with older versions numeric variables starting with
7661 0 are not interpreted as octal. Setting this variable enables proper octal
7662 parsing.
7663 .TP 8
7664 .B path
7665 A list of directories in which to look for executable commands.
7666 A null word specifies the current directory.
7667 If there is no
7668 .Va path
7669 variable then only full path names will execute.
7670 .Va path
7671 is set by the shell at startup from the
7672 .Va PATH
7673 environment
7674 variable or, if
7675 .Va PATH
7676 does not exist, to a system-dependent default
7677 something like
7678 .Sq (/usr/local/bin /usr/bsd /bin /usr/bin .)
7679 The shell may put
7680 .Sq .
7681 first or last in
7682 .Va path
7683 or omit it entirely
7684 depending on how it was compiled; see the
7685 .Va version
7686 shell variable.
7687 A shell which is given neither the
7688 .Fl c\fR nor the
7689 .Fl t\fR option
7690 hashes the contents of the directories in
7691 .Va path
7692 after
7693 reading
7694 .Va ~/.tcshrc
7695 and each time
7696 .Va path
7697 is reset.
7698 If one adds a new command to a directory in
7699 .Va path
7700 while the shell
7701 is active, one may need to do a
7702 .Va rehash
7703 for the shell to find it.
7704 .TP 8
7705 .B printexitvalue \fR(+)
7706 If set and an interactive program exits with a non-zero status, the shell
7707 prints
7708 .Sq Exit
7709 .Va status
7710 .TP 8
7711 .B prompt
7712 The string which is printed before reading each command from the terminal.
7713 .Va prompt
7714 may include any of the following formatting sequences (+), which
7715 are replaced by the given information:
7716 .Pp
7717 .RS +8
7718 .PD 0
7719 .TP 4
7720 %/
7721 The current working directory.
7722 .TP 4
7723 %~
7724 The current working directory, but with one's home directory
7725 represented by
7726 .Sq ~
7727 and other users' home directories represented by
7728 `~user' as per
7729 .Va Filename substitution
7730 `~user' substitution
7731 happens only if the shell has already used
7732 .Sq ~
7733 .Va user
7734 in a pathname
7735 in the current session.
7736 .TP 4
7737 %c[[0]
7738 .Va n
7739 ], %.[[0]
7740 .Va n
7741 ]
7742 The trailing component of the current working directory, or
7743 .Va n
7744 trailing components if a digit
7745 .Va n
7746 is given.
7747 If
7748 .Va n
7749 begins with
7750 .Sq 0
7751 , the number of skipped components precede
7752 the trailing component(s) in the format
7753 .Sq /<
7754 .Va skipped
7755 >trailing
7756 If the
7757 .Va ellipsis
7758 shell variable is set, skipped components
7759 are represented by an ellipsis so the whole becomes
7760 .Sq ...trailing
7761 `~' substitution is done as in
7762 .Sq %~
7763 above, but the
7764 .Sq ~
7765 component
7766 is ignored when counting trailing components.
7767 .TP 4
7768 %C
7769 Like %c, but without
7770 .Sq ~
7771 substitution.
7772 .TP 4
7773 %h, %!, !
7774 The current history event number.
7775 .TP 4
7776 %M
7777 The full hostname.
7778 .TP 4
7779 %m
7780 The hostname up to the first
7781 .Sq .
7782 .TP 4
7783 %S (%s)
7784 Start (stop) standout mode.
7785 .TP 4
7786 %B (%b)
7787 Start (stop) boldfacing mode.
7788 .TP 4
7789 %U (%u)
7790 Start (stop) underline mode.
7791 .TP 4
7792 %t, %@
7793 The time of day in 12-hour AM/PM format.
7794 .TP 4
7795 %T
7796 Like
7797 .Sq %t
7798 , but in 24-hour format (but see the
7799 .Va ampm
7800 shell variable).
7801 .TP 4
7802 %p
7803 The
7804 .Sq precise
7805 time of day in 12-hour AM/PM format, with seconds.
7806 .TP 4
7807 %P
7808 Like
7809 .Sq %p
7810 , but in 24-hour format (but see the
7811 .Va ampm
7812 shell variable).
7813 .TP 4
7814 \e
7815 .Va c
7816 .Va c
7817 is parsed as in
7818 .Va bindkey
7819 .TP 4
7820 ^
7821 .Va c
7822 .Va c
7823 is parsed as in
7824 .Va bindkey
7825 .TP 4
7826 %%
7827 A single
7828 .Sq %
7829 .TP 4
7830 %n
7831 The user name.
7832 .TP 4
7833 %N
7834 The effective user name.
7835 .TP 4
7836 %j
7837 The number of jobs.
7838 .TP 4
7839 %d
7840 The weekday in
7841 .Sq Day
7842 format.
7843 .TP 4
7844 %D
7845 The day in
7846 .Sq dd
7847 format.
7848 .TP 4
7849 %w
7850 The month in
7851 .Sq Mon
7852 format.
7853 .TP 4
7854 %W
7855 The month in
7856 .Sq mm
7857 format.
7858 .TP 4
7859 %y
7860 The year in
7861 .Sq yy
7862 format.
7863 .TP 4
7864 %Y
7865 The year in
7866 .Sq yyyy
7867 format.
7868 .TP 4
7869 %l
7870 The shell's tty.
7871 .TP 4
7872 %L
7873 Clears from the end of the prompt to end of the display or the end of the line.
7874 .TP 4
7875 %$
7876 Expands the shell or environment variable name immediately after the
7877 .Sq $
7878 .TP 4
7879 %#
7880 `>' (or the first character of the
7881 .Va promptchars
7882 shell variable)
7883 for normal users,
7884 .Sq #
7885 (or the second character of
7886 .Va promptchars
7887 )
7888 for the superuser.
7889 .TP 4
7890 %{
7891 .Va string
7892 %}
7893 Includes
7894 .Va string
7895 as a literal escape sequence.
7896 It should be used only to change terminal attributes and
7897 should not move the cursor location.
7898 This
7899 cannot be the last sequence in
7900 .Va prompt
7901 .TP 4
7902 %?
7903 The return code of the command executed just before the prompt.
7904 .TP 4
7905 %R
7906 In
7907 .Va prompt2
7908 , the status of the parser.
7909 In
7910 .Va prompt3
7911 , the corrected string.
7912 In
7913 .Va history
7914 , the history string.
7915 .PD
7916 .Pp
7917 `%B',
7918 .Sq %S
7919 ,
7920 .Sq %U
7921 and
7922 .Sq %{
7923 .Va string
7924 %}
7925 are available in only
7926 eight-bit-clean shells; see the
7927 .Va version
7928 shell variable.
7929 .Pp
7930 The bold, standout and underline sequences are often used to distinguish a
7931 superuser shell.
7932 For example,
7933 .IP "" 4
7934 > set prompt = "%m [%h] %B[%@]%b [%/] you rang? "
7935 .br
7936 tut [37]
7937 .Va [2:54pm]
7938 [/usr/accts/sys] you rang? _
7939 .Pp
7940 If
7941 .Sq %t
7942 ,
7943 .Sq %@
7944 ,
7945 .Sq %T
7946 ,
7947 .Sq %p
7948 , or
7949 .Sq %P
7950 is used, and
7951 .Va noding
7952 is not set,
7953 then print
7954 .Sq DING!
7955 on the change of hour (i.e,
7956 .Sq \&:00
7957 minutes) instead of
7958 the actual time.
7959 .Pp
7960 Set by default to
7961 .Sq %#
7962 in interactive shells.
7963 .RE
7964 .TP 8
7965 .B prompt2 \fR(+)
7966 The string with which to prompt in
7967 .Va while
7968 and
7969 .Va foreach
7970 loops and
7971 after lines ending in
7972 .Sq \e
7973 The same format sequences may be used as in
7974 .Va prompt
7975 (q.v.);
7976 note the variable meaning of
7977 .Sq %R
7978 Set by default to
7979 .Sq %R?
7980 in interactive shells.
7981 .TP 8
7982 .B prompt3 \fR(+)
7983 The string with which to prompt when confirming automatic spelling correction.
7984 The same format sequences may be used as in
7985 .Va prompt
7986 (q.v.);
7987 note the variable meaning of
7988 .Sq %R
7989 Set by default to
7990 .Sq CORRECT>%R (y|n|e|a)?
7991 in interactive shells.
7992 .TP 8
7993 .B promptchars \fR(+)
7994 If set (to a two-character string), the
7995 .Sq %#
7996 formatting sequence in the
7997 .Va prompt
7998 shell variable is replaced with the first character for
7999 normal users and the second character for the superuser.
8000 .TP 8
8001 .B pushdtohome \fR(+)
8002 If set,
8003 .Va pushd
8004 without arguments does
8005 .Sq pushd ~
8006 , like
8007 .Va cd
8008 .TP 8
8009 .B pushdsilent \fR(+)
8010 If set,
8011 .Va pushd
8012 and
8013 .Va popd
8014 do not print the directory stack.
8015 .TP 8
8016 .B recexact \fR(+)
8017 If set, completion completes on an exact match even if a longer match is
8018 possible.
8019 .TP 8
8020 .B recognize_only_executables \fR(+)
8021 If set, command listing displays only files in the path that are
8022 executable.
8023 Slow.
8024 .TP 8
8025 .B rmstar \fR(+)
8026 If set, the user is prompted before
8027 .Sq rm *
8028 is executed.
8029 .TP 8
8030 .B rprompt \fR(+)
8031 The string to print on the right-hand side of the screen (after
8032 the command input) when the prompt is being displayed on the left.
8033 It recognizes the same formatting characters as
8034 .Va prompt
8035 It will automatically disappear and reappear as necessary, to ensure that
8036 command input isn't obscured, and will appear only if the prompt,
8037 command input, and itself will fit together on the first line.
8038 If
8039 .Va edit
8040 isn't set, then
8041 .Va rprompt
8042 will be printed after
8043 the prompt and before the command input.
8044 .TP 8
8045 .B savedirs \fR(+)
8046 If set, the shell does
8047 .Sq dirs \-S
8048 before exiting.
8049 If the first word is set to a number, at most that many directory stack
8050 entries are saved.
8051 .TP 8
8052 .B savehist
8053 If set, the shell does
8054 .Sq history \-S
8055 before exiting.
8056 If the first word is set to a number, at most that many lines are saved.
8057 (The number should be less than or equal to the number
8058 .Va history
8059 entries;
8060 if it is set to greater than the number of
8061 .Va history
8062 settings, only
8063 .Va history
8064 entries will be saved)
8065 If the second word is set to
8066 .Sq merge
8067 , the history list is merged with
8068 the existing history file instead of replacing it (if there is one) and
8069 sorted by time stamp and the most recent events are retained.
8070 If the second word of
8071 .Va savehist
8072 is
8073 .Sq merge
8074 and the third word is set to
8075 `lock', the history file update will be serialized with other shell sessions
8076 that would possibly like to merge history at exactly the same time. (+)
8077 .TP 8
8078 .B sched \fR(+)
8079 The format in which the
8080 .Va sched
8081 builtin command prints scheduled events;
8082 if not given,
8083 .Sq %h\et%T\et%R\en
8084 is used.
8085 The format sequences are described above under
8086 .Va prompt
8087 ;
8088 note the variable meaning of
8089 .Sq %R
8090 .TP 8
8091 .B shell
8092 The file in which the shell resides.
8093 This is used in forking
8094 shells to interpret files which have execute bits set, but
8095 which are not executable by the system.
8096 (See the description
8097 of
8098 .Va Builtin and non-builtin command execution
8099 .)  Initialized to the
8100 (system-dependent) home of the shell.
8101 .TP 8
8102 .B shlvl \fR(+)
8103 The number of nested shells.
8104 Reset to 1 in login shells.
8105 See also
8106 .Va loginsh
8107 .TP 8
8108 .B status
8109 The exit status from the last command or backquote expansion, or any
8110 command in a pipeline is propagated to
8111 .Va status
8112 (This is also the
8113 default
8114 .Xr csh 1
8115 behavior.)
8116 This default does not match what POSIX mandates (to return the
8117 status of the last command only). To match the POSIX behavior, you need
8118 to unset
8119 .Va anyerror
8120 .RS +8
8121 .Pp
8122 If the
8123 .Va anyerror
8124 variable is unset, the exit status of a pipeline
8125 is determined only from the last command in the pipeline, and the exit
8126 status of a backquote expansion is
8127 .Va not
8128 propagated to
8129 .Va status
8130 .Pp
8131 If a command terminated abnormally, then 0200 is added to the status.
8132 Builtin commands which fail return exit status
8133 .Sq 1
8134 , all other builtin
8135 commands return status
8136 .Sq 0
8137 .RE
8138 .TP 8
8139 .B symlinks \fR(+)
8140 Can be set to several different values to control symbolic link (`symlink')
8141 resolution:
8142 .RS +8
8143 .Pp
8144 If set to
8145 .Sq chase
8146 , whenever the current directory changes to a directory
8147 containing a symbolic link, it is expanded to the real name of the directory
8148 to which the link points.
8149 This does not work for the user's home directory;
8150 this is a bug.
8151 .Pp
8152 If set to
8153 .Sq ignore
8154 , the shell tries to construct a current directory
8155 relative to the current directory before the link was crossed.
8156 This means that
8157 .Va cd
8158 ing through a symbolic link and then
8159 .Sq cd ..
8160 ing
8161 returns one to the original directory.
8162 This affects only builtin commands
8163 and filename completion.
8164 .Pp
8165 If set to
8166 .Sq expand
8167 , the shell tries to fix symbolic links by actually expanding
8168 arguments which look like path names.
8169 This affects any command, not just
8170 builtins.
8171 Unfortunately, this does not work for hard-to-recognize filenames,
8172 such as those embedded in command options.
8173 Expansion may be prevented by
8174 quoting.
8175 While this setting is usually the most convenient, it is sometimes
8176 misleading and sometimes confusing when it fails to recognize an argument
8177 which should be expanded.
8178 A compromise is to use
8179 .Sq ignore
8180 and use the
8181 editor command
8182 .Va normalize-path
8183 (bound by default to ^X-n) when necessary.
8184 .Pp
8185 Some examples are in order.
8186 First, let's set up some play directories:
8187 .IP "" 4
8188 > cd /tmp
8189 .br
8190 > mkdir from from/src to
8191 .br
8192 > ln \-s from/src to/dst
8193 .Pp
8194 Here's the behavior with
8195 .Va symlinks
8196 unset,
8197 .IP "" 4
8198 > cd /tmp/to/dst; echo $cwd
8199 .br
8200 /tmp/to/dst
8201 .br
8202 > cd ..; echo $cwd
8203 .br
8204 /tmp/from
8205 .Pp
8206 here's the behavior with
8207 .Va symlinks
8208 set to
8209 .Sq chase
8210 ,
8211 .IP "" 4
8212 > cd /tmp/to/dst; echo $cwd
8213 .br
8214 /tmp/from/src
8215 .br
8216 > cd ..; echo $cwd
8217 .br
8218 /tmp/from
8219 .Pp
8220 here's the behavior with
8221 .Va symlinks
8222 set to
8223 .Sq ignore
8224 ,
8225 .IP "" 4
8226 > cd /tmp/to/dst; echo $cwd
8227 .br
8228 /tmp/to/dst
8229 .br
8230 > cd ..; echo $cwd
8231 .br
8232 /tmp/to
8233 .Pp
8234 and here's the behavior with
8235 .Va symlinks
8236 set to
8237 .Sq expand
8238 .IP "" 4
8239 > cd /tmp/to/dst; echo $cwd
8240 .br
8241 /tmp/to/dst
8242 .br
8243 > cd ..; echo $cwd
8244 .br
8245 /tmp/to
8246 .br
8247 > cd /tmp/to/dst; echo $cwd
8248 .br
8249 /tmp/to/dst
8250 .br
8251 > cd ".."; echo $cwd
8252 .br
8253 /tmp/from
8254 .br
8255 > /bin/echo ..
8256 .br
8257 /tmp/to
8258 .br
8259 > /bin/echo ".."
8260 .br
8261 \&..
8262 .Pp
8263 Note that
8264 .Sq expand
8265 expansion 1) works just like
8266 .Sq ignore
8267 for builtins
8268 like
8269 .Va cd
8270 , 2) is prevented by quoting, and 3) happens before
8271 filenames are passed to non-builtin commands.
8272 .RE
8273 .TP 8
8274 .B tcsh \fR(+)
8275 The version number of the shell in the format
8276 .Sq R.VV.Pp
8277 ,
8278 where
8279 .Sq R
8280 is the major release number,
8281 .Sq VV
8282 the current version
8283 and
8284 .Sq PP
8285 the patchlevel.
8286 .TP 8
8287 .B term
8288 The terminal type.
8289 Usually set in
8290 .Va ~/.login
8291 as described under
8292 .Va Startup and shutdown
8293 .TP 8
8294 .B time
8295 If set to a number, then the
8296 .Va time
8297 builtin (q.v.) executes automatically
8298 after each command which takes more than that many CPU seconds.
8299 If there is a second word, it is used as a format string for the output
8300 of the
8301 .Va time
8302 builtin.
8303 (u) The following sequences may be used in the
8304 format string:
8305 .Pp
8306 .RS +8
8307 .PD 0
8308 .TP 4
8309 %U
8310 The time the process spent in user mode in cpu seconds.
8311 .TP 4
8312 %S
8313 The time the process spent in kernel mode in cpu seconds.
8314 .TP 4
8315 %E
8316 The elapsed (wall clock) time in seconds.
8317 .TP 4
8318 %P
8319 The CPU percentage computed as (%U + %S) / %E.
8320 .TP 4
8321 %W
8322 Number of times the process was swapped.
8323 .TP 4
8324 %X
8325 The average amount in (shared) text space used in Kbytes.
8326 .TP 4
8327 %D
8328 The average amount in (unshared) data/stack space used in Kbytes.
8329 .TP 4
8330 %K
8331 The total space used (%X + %D) in Kbytes.
8332 .TP 4
8333 %M
8334 The maximum memory the process had in use at any time in Kbytes.
8335 .TP 4
8336 %F
8337 The number of major page faults (page needed to be brought from disk).
8338 .TP 4
8339 %R
8340 The number of minor page faults.
8341 .TP 4
8342 %I
8343 The number of input operations.
8344 .TP 4
8345 %O
8346 The number of output operations.
8347 .TP 4
8348 %r
8349 The number of socket messages received.
8350 .TP 4
8351 %s
8352 The number of socket messages sent.
8353 .TP 4
8354 %k
8355 The number of signals received.
8356 .TP 4
8357 %w
8358 The number of voluntary context switches (waits).
8359 .TP 4
8360 %c
8361 The number of involuntary context switches.
8362 .PD
8363 .Pp
8364 Only the first four sequences are supported on systems without BSD resource
8365 limit functions.
8366 The default time format is
8367 .Sq %Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww
8368 for
8369 systems that support resource usage reporting and
8370 .Sq %Uu %Ss %E %P
8371 for
8372 systems that do not.
8373 .Pp
8374 Under Sequent's DYNIX/ptx, %X, %D, %K, %r and %s are not
8375 available, but the following additional sequences are:
8376 .Pp
8377 .PD 0
8378 .TP 4
8379 %Y
8380 The number of system calls performed.
8381 .TP 4
8382 %Z
8383 The number of pages which are zero-filled on demand.
8384 .TP 4
8385 %i
8386 The number of times a process's resident set size was increased by the kernel.
8387 .TP 4
8388 %d
8389 The number of times a process's resident set size was decreased by the kernel.
8390 .TP 4
8391 %l
8392 The number of read system calls performed.
8393 .TP 4
8394 %m
8395 The number of write system calls performed.
8396 .TP 4
8397 %p
8398 The number of reads from raw disk devices.
8399 .TP 4
8400 %q
8401 The number of writes to raw disk devices.
8402 .PD
8403 .Pp
8404 and the default time format is
8405 .Sq %Uu %Ss %E %P %I+%Oio %Fpf+%Ww
8406 Note that the CPU percentage can be higher than 100% on multi-processors.
8407 .RE
8408 .TP 8
8409 .B tperiod \fR(+)
8410 The period, in minutes, between executions of the
8411 .Va periodic
8412 special alias.
8413 .TP 8
8414 .B tty \fR(+)
8415 The name of the tty, or empty if not attached to one.
8416 .TP 8
8417 .B uid \fR(+)
8418 The user's real user ID.
8419 .TP 8
8420 .B user
8421 The user's login name.
8422 .TP 8
8423 .B verbose
8424 If set, causes the words of each
8425 command to be printed, after history substitution (if any).
8426 Set by the
8427 .Fl v\fR command line option.
8428 .TP 8
8429 .B version \fR(+)
8430 The version ID stamp.
8431 It contains the shell's version number (see
8432 .Va tcsh
8433 ),
8434 origin, release date, vendor, operating system and machine (see
8435 .Va VENDOR
8436 ,
8437 .Va OSTYPE
8438 and
8439 .Va MACHTYPE
8440 ) and a comma-separated
8441 list of options which were set at compile time.
8442 Options which are set by default in the distribution are noted.
8443 .Pp
8444 .RS +8
8445 .PD 0
8446 .TP 6
8447 8b
8448 The shell is eight bit clean; default
8449 .TP 6
8450 7b
8451 The shell is not eight bit clean
8452 .TP 6
8453 wide
8454 The shell is multibyte encoding clean (like UTF-8)
8455 .TP 6
8456 nls
8457 The system's NLS is used; default for systems with NLS
8458 .TP 6
8459 lf
8460 Login shells execute
8461 .Va /etc/csh.login
8462 before instead of after
8463 .Va /etc/csh.cshrc
8464 and
8465 .Va ~/.login
8466 before instead of after
8467 .Va ~/.tcshrc
8468 and
8469 .Va ~/.history
8470 .TP 6
8471 dl
8472 `.' is put last in
8473 .Va path
8474 for security; default
8475 .TP 6
8476 nd
8477 `.' is omitted from
8478 .Va path
8479 for security
8480 .TP 6
8481 vi
8482 .Va vi
8483 (1)\-style editing is the default rather than
8484 .Va emacs
8485 (1)\-style
8486 .TP 6
8487 dtr
8488 Login shells drop DTR when exiting
8489 .TP 6
8490 bye
8491 .Va bye
8492 is a synonym for
8493 .Va logout
8494 and
8495 .Va log
8496 is an alternate name for
8497 .Va watchlog
8498 .TP 6
8499 al
8500 .Va autologout
8501 is enabled; default
8502 .TP 6
8503 kan
8504 Kanji is used if appropriate according to locale settings,
8505 unless the
8506 .Va nokanji
8507 shell variable is set
8508 .TP 6
8509 sm
8510 The system's
8511 .Va malloc
8512 (3) is used
8513 .TP 6
8514 hb
8515 The
8516 .Sq #!<program> <args>
8517 convention is emulated when executing shell scripts
8518 .TP 6
8519 ng
8520 The
8521 .Va newgrp
8522 builtin is available
8523 .TP 6
8524 rh
8525 The shell attempts to set the
8526 .Va REMOTEHOST
8527 environment variable
8528 .TP 6
8529 afs
8530 The shell verifies your password with the kerberos server if local
8531 authentication fails.
8532 The
8533 .Va afsuser
8534 shell variable or the
8535 .Va AFSUSER
8536 environment variable override your local username if set.
8537 .PD
8538 .Pp
8539 An administrator may enter additional strings to indicate differences
8540 in the local version.
8541 .RE
8542 .TP 8
8543 .B vimode \fR(+)
8544 .RS +8
8545 If unset, various key bindings change behavior to be more
8546 .Va emacs
8547 (1)\-style:
8548 word boundaries are determined by
8549 .Va wordchars
8550 versus other characters.
8551 .Pp
8552 If set, various key bindings change behavior to be more
8553 .Va vi
8554 (1)\-style:
8555 word boundaries are determined by
8556 .Va wordchars
8557 versus whitespace
8558 versus other characters;
8559 cursor behavior depends upon current vi mode (command, delete, insert, replace).
8560 .Pp
8561 This variable is unset by
8562 .Va bindkey
8563
8564 .Va -e
8565 and
8566 set by
8567 .Va bindkey
8568
8569 .Va -v
8570 .B vimode
8571 may be explicitly set or unset by the user after those
8572 .Va bindkey
8573 operations if required.
8574 .RE
8575 .TP 8
8576 .B visiblebell \fR(+)
8577 If set, a screen flash is used rather than the audible bell.
8578 See also
8579 .Va nobeep
8580 .TP 8
8581 .B watch \fR(+)
8582 A list of user/terminal pairs to watch for logins and logouts.
8583 If either the user is
8584 .Sq any
8585 all terminals are watched for the given user
8586 and vice versa.
8587 Setting
8588 .Va watch
8589 to
8590 .Sq (any any)
8591 watches all users and terminals.
8592 For example,
8593 .RS +8
8594 .IP "" 4
8595 set watch = (george ttyd1 any console $user any)
8596 .Pp
8597 reports activity of the user
8598 .Sq george
8599 on ttyd1, any user on the console, and
8600 oneself (or a trespasser) on any terminal.
8601 .Pp
8602 Logins and logouts are checked every 10 minutes by default, but the first
8603 word of
8604 .Va watch
8605 can be set to a number to check every so many minutes.
8606 For example,
8607 .IP "" 4
8608 set watch = (1 any any)
8609 .Pp
8610 reports any login/logout once every minute.
8611 For the impatient, the
8612 .Va log
8613 builtin command triggers a
8614 .Va watch
8615 report at any time.
8616 All current logins
8617 are reported (as with the
8618 .Va log
8619 builtin) when
8620 .Va watch
8621 is first set.
8622 .Pp
8623 The
8624 .Va who
8625 shell variable controls the format of
8626 .Va watch
8627 reports.
8628 .RE
8629 .TP 8
8630 .B who \fR(+)
8631 The format string for
8632 .Va watch
8633 messages.
8634 The following sequences
8635 are replaced by the given information:
8636 .Pp
8637 .RS +8
8638 .PD 0
8639 .TP 4
8640 %n
8641 The name of the user who logged in/out.
8642 .TP 4
8643 %a
8644 The observed action, i.e.,
8645 .Sq logged on
8646 ,
8647 .Sq logged off
8648 or
8649 .Sq replaced
8650 .Va olduser
8651 on
8652 .TP 4
8653 %l
8654 The terminal (tty) on which the user logged in/out.
8655 .TP 4
8656 %M
8657 The full hostname of the remote host, or
8658 .Sq local
8659 if the login/logout was
8660 from the local host.
8661 .TP 4
8662 %m
8663 The hostname of the remote host up to the first
8664 .Sq .
8665 The full name is printed if it is an IP address or an X Window System display.
8666 .PD
8667 .Pp
8668 %M and %m are available on only systems that store the remote hostname in
8669 .Va /etc/utmp
8670 If unset,
8671 .Sq %n has %a %l from %m.
8672 is used, or
8673 .Sq %n has %a %l.
8674 on systems
8675 which don't store the remote hostname.
8676 .RE
8677 .TP 8
8678 .B wordchars \fR(+)
8679 A list of non-alphanumeric characters to be considered part of a word by the
8680 .Va forward-word
8681 ,
8682 .Va backward-word
8683 etc., editor commands.
8684 If unset, the default value is determined based on the state of
8685 .Va vimode
8686 :
8687 if
8688 .Va vimode
8689 is unset,
8690 .Sq *?_\-.[]~=
8691 is used as the default;
8692 if
8693 .Va vimode
8694 is set,
8695 .Sq _
8696 is used as the default.
8697 .Sh ENVIRONMENT
8698 .TP 8
8699 .B AFSUSER \fR(+)
8700 Equivalent to the
8701 .Va afsuser
8702 shell variable.
8703 .TP 8
8704 .B COLUMNS
8705 The number of columns in the terminal.
8706 See
8707 .Va Terminal management
8708 .TP 8
8709 .B DISPLAY
8710 Used by X Window System (see
8711 .Va X
8712 (1)).
8713 If set, the shell does not set
8714 .Va autologout
8715 (q.v.).
8716 .TP 8
8717 .B EDITOR
8718 The pathname to a default editor.
8719 Used by the
8720 .Va run-fg-editor
8721 editor command if the
8722 the
8723 .Va editors
8724 shell variable is unset.
8725 See also the
8726 .Va VISUAL
8727 environment variable.
8728 .TP 8
8729 .B GROUP \fR(+)
8730 Equivalent to the
8731 .Va group
8732 shell variable.
8733 .TP 8
8734 .B HOME
8735 Equivalent to the
8736 .Va home
8737 shell variable.
8738 .TP 8
8739 .B HOST \fR(+)
8740 Initialized to the name of the machine on which the shell
8741 is running, as determined by the
8742 .Va gethostname
8743 (2) system call.
8744 .TP 8
8745 .B HOSTTYPE \fR(+)
8746 Initialized to the type of machine on which the shell
8747 is running, as determined at compile time.
8748 This variable is obsolete and
8749 will be removed in a future version.
8750 .TP 8
8751 .B HPATH \fR(+)
8752 A colon-separated list of directories in which the
8753 .Va run-help
8754 editor
8755 command looks for command documentation.
8756 .TP 8
8757 .B LANG
8758 Gives the preferred character environment.
8759 See
8760 .Va Native Language System support
8761 .TP 8
8762 .B LC_CTYPE
8763 If set, only ctype character handling is changed.
8764 See
8765 .Va Native Language System support
8766 .TP 8
8767 .B LINES
8768 The number of lines in the terminal.
8769 See
8770 .Va Terminal management
8771 .TP 8
8772 .B LS_COLORS
8773 The format of this variable is reminiscent of the
8774 .Va termcap(5)
8775 file format; a colon-separated list of expressions of the form
8776 "
8777 .Va xx=string
8778 ", where "
8779 .Va xx
8780 " is a two-character variable name.
8781 The
8782 variables with their associated defaults are:
8783 .Pp
8784 .RS +8
8785 .RS +4
8786 .PD 0
8787 .TP 12
8788 no      0
8789 Normal (non-filename) text
8790 .TP 12
8791 fi      0
8792 Regular file
8793 .TP 12
8794 di      01;34
8795 Directory
8796 .TP 12
8797 ln      01;36
8798 Symbolic link
8799 .TP 12
8800 pi      33
8801 Named pipe (FIFO)
8802 .TP 12
8803 so      01;35
8804 Socket
8805 .TP 12
8806 do      01;35
8807 Door
8808 .TP 12
8809 bd      01;33
8810 Block device
8811 .TP 12
8812 cd      01;32
8813 Character device
8814 .TP 12
8815 ex      01;32
8816 Executable file
8817 .TP 12
8818 mi      (none)
8819 Missing file (defaults to fi)
8820 .TP 12
8821 or      (none)
8822 Orphaned symbolic link (defaults to ln)
8823 .TP 12
8824 lc      ^[[
8825 Left code
8826 .TP 12
8827 rc      m
8828 Right code
8829 .TP 12
8830 ec      (none)
8831 End code (replaces lc+no+rc)
8832 .PD
8833 .RE
8834 .Pp
8835 You need to include only the variables you want to change from
8836 the default.
8837 .Pp
8838 File names can also be colorized based on filename extension.
8839 This is specified in the
8840 .Va LS_COLORS
8841 variable using the syntax
8842 .Va "*ext=string"
8843 For example, using ISO 6429 codes, to color
8844 all C\-language source files blue you would specify
8845 .Va "*.c=34"
8846 This would color all files ending in
8847 .Va .c
8848 in blue (34) color.
8849 .Pp
8850 Control characters can be written either in C\-style\-escaped
8851 notation, or in stty\-like ^\-notation.
8852 The C\-style notation
8853 adds
8854 .Va ^[
8855 for Escape, \fB\_\fR for a normal space character,
8856 and
8857 .Va ?
8858 for Delete.
8859 In addition, the
8860 .Va ^[
8861 escape character
8862 can be used to override the default interpretation of
8863 .Va ^[
8864 ,
8865 .Va ^
8866 ,
8867 .Va :
8868 and
8869 .Va =
8870 .Pp
8871 Each file will be written as
8872 .Va <lc>
8873
8874 .Va <color-code>
8875 .Va <rc>
8876
8877 .Va <filename>
8878
8879 .Va <ec>
8880 If the
8881 .Va <ec>
8882 code is undefined, the sequence
8883 .Va <lc>
8884 \fB<no>
8885 .Va <rc>
8886 will be used instead.
8887 This is generally more convenient
8888 to use, but less general.
8889 The left, right and end codes are
8890 provided so you don't have to type common parts over and over
8891 again and to support weird terminals; you will generally not
8892 need to change them at all unless your terminal does not use
8893 ISO 6429 color sequences but a different system.
8894 .Pp
8895 If your terminal does use ISO 6429 color codes, you can
8896 compose the type codes (i.e., all except the
8897 .Va lc
8898 ,
8899 .Va rc
8900 ,
8901 and
8902 .Va ec
8903 codes) from numerical commands separated by semicolons.
8904 The
8905 most common commands are:
8906 .Pp
8907 .RS +8
8908 .PD 0
8909 .TP 4
8910 0
8911 to restore default color
8912 .TP 4
8913 1
8914 for brighter colors
8915 .TP 4
8916 4
8917 for underlined text
8918 .TP 4
8919 5
8920 for flashing text
8921 .TP 4
8922 30
8923 for black foreground
8924 .TP 4
8925 31
8926 for red foreground
8927 .TP 4
8928 32
8929 for green foreground
8930 .TP 4
8931 33
8932 for yellow (or brown) foreground
8933 .TP 4
8934 34
8935 for blue foreground
8936 .TP 4
8937 35
8938 for purple foreground
8939 .TP 4
8940 36
8941 for cyan foreground
8942 .TP 4
8943 37
8944 for white (or gray) foreground
8945 .TP 4
8946 40
8947 for black background
8948 .TP 4
8949 41
8950 for red background
8951 .TP 4
8952 42
8953 for green background
8954 .TP 4
8955 43
8956 for yellow (or brown) background
8957 .TP 4
8958 44
8959 for blue background
8960 .TP 4
8961 45
8962 for purple background
8963 .TP 4
8964 46
8965 for cyan background
8966 .TP 4
8967 47
8968 for white (or gray) background
8969 .PD
8970 .RE
8971 .Pp
8972 Not all commands will work on all systems or display devices.
8973 .Pp
8974 A few terminal programs do not recognize the default end code
8975 properly.
8976 If all text gets colorized after you do a directory
8977 listing, try changing the
8978 .Va no
8979 and
8980 .Va fi
8981 codes from 0 to the
8982 numerical codes for your standard fore- and background colors.
8983 .RE
8984 .TP 8
8985 .B MACHTYPE \fR(+)
8986 The machine type (microprocessor class or machine model), as determined at compile time.
8987 .TP 8
8988 .B NOREBIND \fR(+)
8989 If set, printable characters are not rebound to
8990 .Va self-insert-command
8991 See
8992 .Va Native Language System support
8993 .TP 8
8994 .B OSTYPE \fR(+)
8995 The operating system, as determined at compile time.
8996 .TP 8
8997 .B PATH
8998 A colon-separated list of directories in which to look for executables.
8999 Equivalent to the
9000 .Va path
9001 shell variable, but in a different format.
9002 .TP 8
9003 .B PWD \fR(+)
9004 Equivalent to the
9005 .Va cwd
9006 shell variable, but not synchronized to it;
9007 updated only after an actual directory change.
9008 .TP 8
9009 .B REMOTEHOST \fR(+)
9010 The host from which the user has logged in remotely, if this is the case and
9011 the shell is able to determine it.
9012 Set only if the shell was so compiled;
9013 see the
9014 .Va version
9015 shell variable.
9016 .TP 8
9017 .B SHLVL \fR(+)
9018 Equivalent to the
9019 .Va shlvl
9020 shell variable.
9021 .TP 8
9022 .B SYSTYPE \fR(+)
9023 The current system type.
9024 (Domain/OS only)
9025 .TP 8
9026 .B TERM
9027 Equivalent to the
9028 .Va term
9029 shell variable.
9030 .TP 8
9031 .B TERMCAP
9032 The terminal capability string.
9033 See
9034 .Va Terminal management
9035 .TP 8
9036 .B USER
9037 Equivalent to the
9038 .Va user
9039 shell variable.
9040 .TP 8
9041 .B VENDOR \fR(+)
9042 The vendor, as determined at compile time.
9043 .TP 8
9044 .B VISUAL
9045 The pathname to a default full-screen editor.
9046 Used by the
9047 .Va run-fg-editor
9048 editor command if the
9049 the
9050 .Va editors
9051 shell variable is unset.
9052 See also the
9053 .Va EDITOR
9054 environment variable.
9055 .Sh FILES
9056 .PD 0
9057 .TP 16
9058 .I /etc/csh.cshrc
9059 Read first by every shell.
9060 ConvexOS, Stellix and Intel use
9061 .Va /etc/cshrc
9062 and
9063 NeXTs use
9064 .Va /etc/cshrc.std
9065 A/UX, AMIX, Cray and IRIX have no equivalent in
9066 .Xr csh 1
9067 ,
9068 but read this file in
9069 .Nm
9070 anyway.
9071 Solaris 2.x does not have it either, but
9072 .Nm
9073 reads
9074 .Va /etc/.cshrc
9075 (+)
9076 .TP 16
9077 .I /etc/csh.login
9078 Read by login shells after
9079 .Va /etc/csh.cshrc
9080 ConvexOS, Stellix and Intel use
9081 .Va /etc/login
9082 ,
9083 NeXTs use
9084 .Va /etc/login.std
9085 , Solaris 2.x uses
9086 .Va /etc/.login
9087 and
9088 A/UX, AMIX, Cray and IRIX use
9089 .Va /etc/cshrc
9090 .TP 16
9091 .I ~/.tcshrc \fR(+)
9092 Read by every shell after
9093 .Va /etc/csh.cshrc
9094 or its equivalent.
9095 .TP 16
9096 .I ~/.cshrc
9097 Read by every shell, if
9098 .Va ~/.tcshrc
9099 doesn't exist,
9100 after
9101 .Va /etc/csh.cshrc
9102 or its equivalent.
9103 This manual uses
9104 .Sq
9105 .Va ~/.tcshrc
9106 to mean `
9107 .Va ~/.tcshrc
9108 or,
9109 if
9110 .Va ~/.tcshrc
9111 is not found,
9112 .Va ~/.cshrc
9113 '.
9114 .TP 16
9115 .I ~/.history
9116 Read by login shells after
9117 .Va ~/.tcshrc
9118 if
9119 .Va savehist
9120 is set, but see also
9121 .Va histfile
9122 .TP 16
9123 .I ~/.login
9124 Read by login shells after
9125 .Va ~/.tcshrc
9126 or
9127 .Va ~/.history
9128 The shell may be compiled to read
9129 .Va ~/.login
9130 before instead of after
9131 .Va ~/.tcshrc
9132 and
9133 .Va ~/.history
9134 ; see the
9135 .Va version
9136 shell variable.
9137 .TP 16
9138 .I ~/.cshdirs \fR(+)
9139 Read by login shells after
9140 .Va ~/.login
9141 if
9142 .Va savedirs
9143 is set, but see also
9144 .Va dirsfile
9145 .TP 16
9146 .I /etc/csh.logout
9147 Read by login shells at logout.
9148 ConvexOS, Stellix and Intel use
9149 .Va /etc/logout
9150 and
9151 NeXTs use
9152 .Va /etc/logout.std
9153 A/UX, AMIX, Cray and IRIX have no equivalent in
9154 .Xr csh 1
9155 ,
9156 but read this file in
9157 .Nm
9158 anyway.
9159 Solaris 2.x does not have it either, but
9160 .Nm
9161 reads
9162 .Va /etc/.logout
9163 (+)
9164 .TP 16
9165 .I ~/.logout
9166 Read by login shells at logout after
9167 .Va /etc/csh.logout
9168 or its equivalent.
9169 .TP 16
9170 .I /bin/sh
9171 Used to interpret shell scripts not starting with a
9172 .Sq #
9173 .TP 16
9174 .I /tmp/sh*
9175 Temporary file for
9176 .Sq <<
9177 .TP 16
9178 .I /etc/passwd
9179 Source of home directories for
9180 .Sq ~name
9181 substitutions.
9182 .PD
9183 .Pp
9184 The order in which startup files are read may differ if the shell was so
9185 compiled; see
9186 .Va Startup and shutdown
9187 and the
9188 .Va version
9189 shell variable.
9190 .Sh "NEW FEATURES (+)"
9191 This manual describes
9192 .Nm
9193 as a single entity,
9194 but experienced
9195 .Xr csh 1
9196 users will want to pay special attention to
9197 .Nm
9198 's new features.
9199 .Pp
9200 A command-line editor, which supports
9201 .Va emacs
9202 (1)\-style
9203 or
9204 .Va vi
9205 (1)\-style key bindings.
9206 See
9207 .Va The command-line editor
9208 and
9209 .Va Editor commands
9210 .Pp
9211 Programmable, interactive word completion and listing.
9212 See
9213 .Sx Completion and listing
9214 and the
9215 .Va complete
9216 and
9217 .Va uncomplete
9218 builtin commands.
9219 .Pp
9220 .Va Spelling correction
9221 (q.v.) of filenames, commands and variables.
9222 .Pp
9223 .Va Editor commands
9224 (q.v.) which perform other useful functions in the middle of
9225 typed commands, including documentation lookup
9226 .Va ( run-help ),
9227 quick editor restarting
9228 .Va ( run-fg-editor )
9229 and
9230 command resolution
9231 .Va ( which-command ).
9232 .Pp
9233 An enhanced history mechanism.
9234 Events in the history list are time-stamped.
9235 See also the
9236 .Va history
9237 command and its associated shell variables,
9238 the previously undocumented
9239 .Sq #
9240 event specifier and new modifiers
9241 under
9242 .Va History substitution
9243 ,
9244 the
9245 .Va *-history
9246 ,
9247 .Va history-search-*
9248 ,
9249 .Va i-search-*
9250 ,
9251 .Va vi-search-*
9252 and
9253 .Va toggle-literal-history
9254 editor commands
9255 and the
9256 .Va histlit
9257 shell variable.
9258 .Pp
9259 Enhanced directory parsing and directory stack handling.
9260 See the
9261 .Va cd
9262 ,
9263 .Va pushd
9264 ,
9265 .Va popd
9266 and
9267 .Va dirs
9268 commands and their associated
9269 shell variables, the description of
9270 .Va Directory stack substitution
9271 ,
9272 the
9273 .Va dirstack
9274 ,
9275 .Va owd
9276 and
9277 .Va symlinks
9278 shell variables and
9279 the
9280 .Va normalize-command
9281 and
9282 .Va normalize-path
9283 editor commands.
9284 .Pp
9285 Negation in glob-patterns.
9286 See
9287 .Va Filename substitution
9288 .Pp
9289 New
9290 .Va File inquiry operators
9291 (q.v.) and a
9292 .Va filetest
9293 builtin which uses them.
9294 .Pp
9295 A variety of
9296 .Va Automatic, periodic and timed events
9297 (q.v.) including
9298 scheduled events, special aliases, automatic logout and terminal locking,
9299 command timing and watching for logins and logouts.
9300 .Pp
9301 Support for the Native Language System
9302 (see
9303 .Va Native Language System support
9304 ),
9305 OS variant features
9306 (see
9307 .Va OS variant support
9308 and the
9309 .Va echo_style
9310 shell variable)
9311 and system-dependent file locations (see
9312 .Va FILES
9313 ).
9314 .Pp
9315 Extensive terminal-management capabilities.
9316 See
9317 .Va Terminal management
9318 .Pp
9319 New builtin commands including
9320 .Va builtins
9321 ,
9322 .Va hup
9323 , \fIls\-F\fR,
9324 .Va newgrp
9325 ,
9326 .Va printenv
9327 ,
9328 .Va which
9329 and
9330 .Va where
9331 (q.v.).
9332 .Pp
9333 New variables that make useful information easily available to the shell.
9334 See the
9335 .Va gid
9336 ,
9337 .Va loginsh
9338 ,
9339 .Va oid
9340 ,
9341 .Va shlvl
9342 ,
9343 .Va tcsh
9344 ,
9345 .Va tty
9346 ,
9347 .Va uid
9348 and
9349 .Va version
9350 shell variables and the
9351 .Va HOST
9352 ,
9353 .Va REMOTEHOST
9354 ,
9355 .Va VENDOR
9356 ,
9357 .Va OSTYPE
9358 and
9359 .Va MACHTYPE
9360 environment
9361 variables.
9362 .Pp
9363 A new syntax for including useful information in the prompt string
9364 (see
9365 .Va prompt
9366 ),
9367 and special prompts for loops and spelling correction
9368 (see
9369 .Va prompt2
9370 and
9371 .Va prompt3
9372 ).
9373 .Pp
9374 Read-only variables.
9375 See
9376 .Va Variable substitution
9377 .Sh BUGS
9378 When a suspended command is restarted, the shell prints the directory
9379 it started in if this is different from the current directory.
9380 This can
9381 be misleading (i.e., wrong) as the job may have changed directories internally.
9382 .Pp
9383 Shell builtin functions are not stoppable/restartable.
9384 Command sequences
9385 of the form
9386 .Sq a ; b ; c
9387 are also not handled gracefully when stopping is
9388 attempted.
9389 If you suspend
9390 .Sq b
9391 , the shell will then immediately execute
9392 `c'.
9393 This is especially noticeable if this expansion results from an
9394 .Va alias
9395 It suffices to place the sequence of commands in ()'s to force it
9396 to a subshell, i.e.,
9397 .Sq ( a ; b ; c )
9398 .Pp
9399 Control over tty output after processes are started is primitive; perhaps
9400 this will inspire someone to work on a good virtual terminal interface.
9401 In a virtual terminal interface much more interesting things could be
9402 done with output control.
9403 .Pp
9404 Alias substitution is most often used to clumsily simulate shell procedures;
9405 shell procedures should be provided rather than aliases.
9406 .Pp
9407 Control structures should be parsed rather than being recognized as
9408 built-in commands.
9409 This would allow control commands to be placed anywhere,
9410 to be combined with
9411 .Sq |
9412 , and to be used with
9413 .Sq &
9414 and
9415 .Sq ;
9416 metasyntax.
9417 .Pp
9418 .Va foreach
9419 doesn't ignore here documents when looking for its
9420 .Va end
9421 .Pp
9422 It should be possible to use the
9423 .Sq \&:
9424 modifiers on the output of command
9425 substitutions.
9426 .Pp
9427 The screen update for lines longer than the screen width is very poor
9428 if the terminal cannot move the cursor up (i.e., terminal type
9429 .Sq dumb
9430 ).
9431 .Pp
9432 .Va HPATH
9433 and
9434 .Va NOREBIND
9435 don't need to be environment variables.
9436 .Pp
9437 Glob-patterns which do not use
9438 .Sq \&?
9439 ,
9440 .Sq *
9441 or
9442 .Sq []
9443 or which use
9444 .Sq {}
9445 or
9446 .Sq ~
9447 are not negated correctly.
9448 .Pp
9449 The single-command form of
9450 .Va if
9451 does output redirection even if
9452 the expression is false and the command is not executed.
9453 .Pp
9454 \fIls\-F\fR includes file identification characters when sorting filenames
9455 and does not handle control characters in filenames well.
9456 It cannot be
9457 interrupted.
9458 .Pp
9459 Command substitution supports multiple commands and conditions, but not
9460 cycles or backward
9461 .Va goto
9462 s.
9463 .Pp
9464 Report bugs at https://bugs.astron.com/, preferably with fixes.
9465 If you want to
9466 help maintain and test tcsh, add yourself to the mailing list in
9467 https://mailman.astron.com/.
9468 .Sq subscribe tcsh
9469 on a line by itself in the body.
9470 .Sh THE T IN TCSH
9471 In 1964, DEC produced the PDP-6.
9472 The PDP-10 was a later re-implementation.
9473 It
9474 was re-christened the DECsystem-10 in 1970 or so when DEC brought out the
9475 second model, the KI10.
9476 .Pp
9477 TENEX was created at Bolt, Beranek & Newman (a Cambridge, Massachusetts
9478 think tank) in
9479 1972 as an experiment in demand-paged virtual memory operating systems.
9480 They
9481 built a new pager for the DEC PDP-10 and created the OS to go with it.
9482 It was
9483 extremely successful in academia.
9484 .Pp
9485 In 1975, DEC brought out a new model of the PDP-10, the KL10; they intended to
9486 have only a version of TENEX, which they had licensed from BBN, for the new
9487 box.
9488 They called their version TOPS-20 (their capitalization is trademarked).
9489 A lot of TOPS-10 users (`The OPerating System for PDP-10') objected; thus DEC
9490 found themselves supporting two incompatible systems on the same hardware--but
9491 then there were 6 on the PDP-11!
9492 .Pp
9493 TENEX, and TOPS-20 to version 3, had command completion
9494 via a user-code-level subroutine library called ULTCMD.
9495 With version 3, DEC
9496 moved all that capability and more into the monitor (`kernel' for you Unix
9497 types), accessed by the COMND% JSYS (`Jump to SYStem' instruction, the
9498 supervisor call mechanism [are my IBM roots also showing?]).
9499 .Pp
9500 The creator of tcsh was impressed by this feature and several others of TENEX
9501 and TOPS-20, and created a version of csh which mimicked them.
9502 .Sh LIMITATIONS
9503 The system limits argument lists to ARG_MAX characters.
9504 .Pp
9505 The number of arguments to a command which involves filename expansion is
9506 limited to 1/6th the number of characters allowed in an argument list.
9507 .Pp
9508 Command substitutions may substitute no more characters than are allowed in
9509 an argument list.
9510 .Pp
9511 To detect looping, the shell restricts the number of
9512 .Va alias
9513 substitutions on a single line to 20.
9514 .Sh "SEE ALSO"
9515 csh(1), emacs(1), ls(1), newgrp(1), sh(1), setpath(1), stty(1), su(1),
9516 tset(1), vi(1), x(1), access(2), execve(2), fork(2), killpg(2),
9517 pipe(2), setrlimit(2), sigvec(2), stat(2), umask(2), vfork(2), wait(2),
9518 malloc(3), setlocale(3), tty(4), a.out(5), termcap(5), environ(7),
9519 termio(7), Introduction to the C Shell
9520 .Sh VERSION
9521 This manual documents tcsh 6.21.00 (Astron) 2019-05-08.
9522 .Sh AUTHORS
9523 .PD 0
9524 .TP 2
9525 William Joy
9526 Original author of
9527 .Xr csh 1
9528 .TP 2
9529 J.E. Kulp, IIASA, Laxenburg, Austria
9530 Job control and directory stack features
9531 .TP 2
9532 Ken Greer, HP Labs, 1981
9533 File name completion
9534 .TP 2
9535 Mike Ellis, Fairchild, 1983
9536 Command name recognition/completion
9537 .TP 2
9538 Paul Placeway, Ohio State CIS Dept., 1983-1993
9539 Command line editor, prompt routines, new glob syntax and numerous fixes
9540 and speedups
9541 .TP 2
9542 Karl Kleinpaste, CCI 1983-4
9543 Special aliases, directory stack extraction stuff, login/logout watch,
9544 scheduled events, and the idea of the new prompt format
9545 .TP 2
9546 Rayan Zachariassen, University of Toronto, 1984
9547 \fIls\-F\fR and
9548 .Va which
9549 builtins and numerous bug fixes, modifications
9550 and speedups
9551 .TP 2
9552 Chris Kingsley, Caltech
9553 Fast storage allocator routines
9554 .TP 2
9555 Chris Grevstad, TRW, 1987
9556 Incorporated 4.3BSD
9557 .Xr csh 1
9558 into
9559 .Nm
9560 .TP 2
9561 Christos S. Zoulas, Cornell U. EE Dept., 1987-94
9562 Ports to HPUX, SVR2 and SVR3, a SysV version of getwd.c, SHORT_STRINGS support
9563 and a new version of sh.glob.c
9564 .TP 2
9565 James J Dempsey, BBN, and Paul Placeway, OSU, 1988
9566 A/UX port
9567 .TP 2
9568 Daniel Long, NNSC, 1988
9569 .Va wordchars
9570 .TP 2
9571 Patrick Wolfe, Kuck and Associates, Inc., 1988
9572 .Va vi
9573 mode cleanup
9574 .TP 2
9575 David C Lawrence, Rensselaer Polytechnic Institute, 1989
9576 .Va autolist
9577 and ambiguous completion listing
9578 .TP 2
9579 Alec Wolman, DEC, 1989
9580 Newlines in the prompt
9581 .TP 2
9582 Matt Landau, BBN, 1989
9583 .Va ~/.tcshrc
9584 .TP 2
9585 Ray Moody, Purdue Physics, 1989
9586 Magic space bar history expansion
9587 .TP 2
9588 Mordechai ????, Intel, 1989
9589 printprompt() fixes and additions
9590 .TP 2
9591 Kazuhiro Honda, Dept. of Computer Science, Keio University, 1989
9592 Automatic spelling correction and
9593 .Va prompt3
9594 .TP 2
9595 Per Hedeland, Ellemtel, Sweden, 1990-
9596 Various bugfixes, improvements and manual updates
9597 .TP 2
9598 Hans J. Albertsson (Sun Sweden)
9599 .Va ampm
9600 ,
9601 .Va settc
9602 and
9603 .Va telltc
9604 .TP 2
9605 Michael Bloom
9606 Interrupt handling fixes
9607 .TP 2
9608 Michael Fine, Digital Equipment Corp
9609 Extended key support
9610 .TP 2
9611 Eric Schnoebelen, Convex, 1990
9612 Convex support, lots of
9613 .Xr csh 1
9614 bug fixes,
9615 save and restore of directory stack
9616 .TP 2
9617 Ron Flax, Apple, 1990
9618 A/UX 2.0 (re)port
9619 .TP 2
9620 Dan Oscarsson, LTH Sweden, 1990
9621 NLS support and simulated NLS support for non NLS sites, fixes
9622 .TP 2
9623 Johan Widen, SICS Sweden, 1990
9624 .Va shlvl
9625 , Mach support,
9626 .Va correct-line
9627 , 8-bit printing
9628 .TP 2
9629 Matt Day, Sanyo Icon, 1990
9630 POSIX termio support, SysV limit fixes
9631 .TP 2
9632 Jaap Vermeulen, Sequent, 1990-91
9633 Vi mode fixes, expand-line, window change fixes, Symmetry port
9634 .TP 2
9635 Martin Boyer, Institut de recherche d'Hydro-Quebec, 1991
9636 .Va autolist
9637 beeping options, modified the history search to search for
9638 the whole string from the beginning of the line to the cursor.
9639 .TP 2
9640 Scott Krotz, Motorola, 1991
9641 Minix port
9642 .TP 2
9643 David Dawes, Sydney U. Australia, Physics Dept., 1991
9644 SVR4 job control fixes
9645 .TP 2
9646 Jose Sousa, Interactive Systems Corp., 1991
9647 Extended
9648 .Va vi
9649 fixes and
9650 .Va vi
9651 delete command
9652 .TP 2
9653 Marc Horowitz, MIT, 1991
9654 ANSIfication fixes, new exec hashing code, imake fixes,
9655 .Va where
9656 .TP 2
9657 Bruce Sterling Woodcock, sterling@netcom.com, 1991-1995
9658 ETA and Pyramid port, Makefile and lint fixes,
9659 .Va ignoreeof
9660 =n addition, and
9661 various other portability changes and bug fixes
9662 .TP 2
9663 Jeff Fink, 1992
9664 .Va complete-word-fwd
9665 and
9666 .Va complete-word-back
9667 .TP 2
9668 Harry C. Pulley, 1992
9669 Coherent port
9670 .TP 2
9671 Andy Phillips, Mullard Space Science Lab U.K., 1992
9672 VMS-POSIX port
9673 .TP 2
9674 Beto Appleton, IBM Corp., 1992
9675 Walking process group fixes,
9676 .Xr csh 1
9677 bug fixes,
9678 POSIX file tests, POSIX SIGHUP
9679 .TP 2
9680 Scott Bolte, Cray Computer Corp., 1992
9681 CSOS port
9682 .TP 2
9683 Kaveh R. Ghazi, Rutgers University, 1992
9684 Tek, m88k, Titan and Masscomp ports and fixes.
9685 Added autoconf support.
9686 .TP 2
9687 Mark Linderman, Cornell University, 1992
9688 OS/2 port
9689 .TP 2
9690 Mika Liljeberg, liljeber@kruuna.Helsinki.FI, 1992
9691 Linux port
9692 .TP 2
9693 Tim P. Starrin, NASA Langley Research Center Operations, 1993
9694 Read-only variables
9695 .TP 2
9696 Dave Schweisguth, Yale University, 1993-4
9697 New man page and tcsh.man2html
9698 .TP 2
9699 Larry Schwimmer, Stanford University, 1993
9700 AFS and HESIOD patches
9701 .TP 2
9702 Luke Mewburn, RMIT University, 1994-6
9703 Enhanced directory printing in prompt,
9704 added
9705 .Va ellipsis
9706 and
9707 .Va rprompt
9708 .TP 2
9709 Edward Hutchins, Silicon Graphics Inc., 1996
9710 Added implicit cd.
9711 .TP 2
9712 Martin Kraemer, 1997
9713 Ported to Siemens Nixdorf EBCDIC machine
9714 .TP 2
9715 Amol Deshpande, Microsoft, 1997
9716 Ported to WIN32 (Windows/95 and Windows/NT); wrote all the missing library
9717 and message catalog code to interface to Windows.
9718 .TP 2
9719 Taga Nayuta, 1998
9720 Color ls additions.
9721 .PD
9722 .Pp
9723 .Sh "THANKS TO"
9724 Bryan Dunlap, Clayton Elwell, Karl Kleinpaste, Bob Manson, Steve Romig,
9725 Diana Smetters, Bob Sutterfield, Mark Verber, Elizabeth Zwicky and all
9726 the other people at Ohio State for suggestions and encouragement
9727 .Pp
9728 All the people on the net, for putting up with,
9729 reporting bugs in, and suggesting new additions to each and every version
9730 .Pp
9731 Richard M. Alderson III, for writing the
9732 .Sq T in tcsh
9733 section