getconf: don't include xpg4 bits, gcc7 includes xpg6 bits for us
[unleashed.git] / share / man / man1 / csh.1
blobf988efdad9bc4bd1751bc320e739ac7e61bb1c53
1 '\" te
2 .\" Copyright 1989 AT&T
3 .\" Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH CSH 1 "April 9, 2016"
8 .SH NAME
9 csh \- shell command interpreter with a C-like syntax
10 .SH SYNOPSIS
11 .LP
12 .nf
13 \fBcsh\fR [\fB-bcefinstvVxX\fR] [\fIargument\fR]...
14 .fi
16 .SH DESCRIPTION
17 .LP
18 \fBcsh\fR, the C shell, is a command interpreter with a syntax reminiscent of
19 the C language. It provides a number of convenient features for interactive use
20 that are not available with the Bourne shell, including filename completion,
21 command aliasing, history substitution, job control, and a number of built-in
22 commands. As with the Bourne shell, the C shell provides variable, command and
23 filename substitution.
24 .SS "Initialization and Termination"
25 .LP
26 When first started, the C shell normally performs commands from the
27 \fB\&.cshrc\fR file in your home directory, provided that it is readable and
28 you either own it or your real group \fBID\fR matches its group \fBID\fR. If
29 the shell is invoked with a name that starts with `\fB\(mi\fR\&', as when
30 started by \fBlogin\fR(1), the shell runs as a \fBlogin\fR shell.
31 .sp
32 .LP
33 If the shell is a login shell, this is the sequence of invocations: First,
34 commands in \fB/etc/.login\fR are executed. Next, commands from the
35 \fB\&.cshrc\fR file your \fBhome\fR directory are executed. Then the shell
36 executes commands from the \fB\&.login\fR file in your home directory; the same
37 permission checks as those for \fB\&.cshrc\fR are applied to this file.
38 Typically, the \fB\&.login\fR file contains commands to specify the terminal
39 type and environment. (For an explanation of file interpreters, see \fBCommand
40 Execution\fR and \fBexec\fR(2).)
41 .sp
42 .LP
43 As a login shell terminates, it performs commands from the \fB\&.logout\fR file
44 in your home directory; the same permission checks as those for \fB\&.cshrc\fR
45 are applied to this file.
46 .SS "Interactive Operation"
47 .LP
48 After startup processing is complete, an interactive C shell begins reading
49 commands from the terminal, prompting with \fBhostname\fR\fB%\fR (or
50 \fBhostname\fR\fB#\fR for the privileged user). The shell then repeatedly
51 performs the following actions: a line of command input is read and broken into
52 \fIwords\fR. This sequence of words is placed on the history list and then
53 parsed, as described under USAGE. Finally, the shell executes each command in
54 the current line.
55 .SS "Noninteractive Operation"
56 .LP
57 When running noninteractively, the shell does not prompt for input from the
58 terminal. A noninteractive C shell can execute a command supplied as an
59 \fIargument\fR on its command line, or interpret commands from a file, also
60 known as a script.
61 .SH OPTIONS
62 .LP
63 The following options are supported:
64 .sp
65 .ne 2
66 .na
67 \fB\fB-b\fR\fR
68 .ad
69 .RS 6n
70 Forced a "break" from option processing. Subsequent command line arguments are
71 not interpreted as C shell options. This allows the passing of options to a
72 script without confusion. The shell does not run set-user-ID or set-group-ID
73 scripts unless this option is present.
74 .RE
76 .sp
77 .ne 2
78 .na
79 \fB\fB-c\fR\fR
80 .ad
81 .RS 6n
82 Executes the first \fIargument\fR, which must be present. Remaining arguments
83 are placed in \fBargv\fR, the argument-list variable, and passed directly to
84 \fBcsh\fR.
85 .RE
87 .sp
88 .ne 2
89 .na
90 \fB\fB-e\fR\fR
91 .ad
92 .RS 6n
93 Exits if a command terminates abnormally or yields a nonzero exit status.
94 .RE
96 .sp
97 .ne 2
98 .na
99 \fB\fB-f\fR\fR
101 .RS 6n
102 Fast start. Reads neither the \fB\&.cshrc\fR file, nor the \fB\&.login\fR file
103 (if a login shell) upon startup.
107 .ne 2
109 \fB\fB-i\fR\fR
111 .RS 6n
112 Forced interactive. Prompts for command line input, even if the standard input
113 does not appear to be a terminal (character-special device).
117 .ne 2
119 \fB\fB-n\fR\fR
121 .RS 6n
122 Parses (interprets), but does not execute commands. This option can be used to
123 check C shell scripts for syntax errors.
127 .ne 2
129 \fB\fB-s\fR\fR
131 .RS 6n
132 Takes commands from the standard input.
136 .ne 2
138 \fB\fB-t\fR\fR
140 .RS 6n
141 Reads and executes a single command line. A `\fB\e\fR\&' (backslash) can be
142 used to escape each newline for continuation of the command line onto
143 subsequent input lines.
147 .ne 2
149 \fB\fB-v\fR\fR
151 .RS 6n
152 Verbose. Sets the \fBverbose\fR predefined variable. Command input is echoed
153 after history substitution, but before other substitutions and before
154 execution.
158 .ne 2
160 \fB\fB-V\fR\fR
162 .RS 6n
163 Sets \fBverbose\fR before reading \fB\&.cshrc\fR.
167 .ne 2
169 \fB\fB-x\fR\fR
171 .RS 6n
172 Echo. Sets the \fBecho\fR variable. Echoes commands after all substitutions and
173 just before execution.
177 .ne 2
179 \fB\fB-X\fR\fR
181 .RS 6n
182 Sets \fBecho\fR before reading \fB\&.cshrc\fR.
187 Except with the options \fB-c\fR, \fB-i\fR, \fB-s\fR, or \fB-t\fR, the first
188 nonoption \fIargument\fR is taken to be the name of a command or script. It is
189 passed as argument zero, and subsequent arguments are added to the argument
190 list for that command or script.
191 .SH USAGE
192 .SS "Filename Completion"
194 When enabled by setting the variable \fBfilec\fR, an interactive C shell can
195 complete a partially typed filename or user name. When an unambiguous partial
196 filename is followed by an \fBESC\fR character on the terminal input line, the
197 shell fills in the remaining characters of a matching filename from the working
198 directory.
201 If a partial filename is followed by the \fBEOF\fR character (usually typed as
202 Control-d), the shell lists all filenames that match. It then prompts once
203 again, supplying the incomplete command line typed in so far.
206 When the last (partial) word begins with a tilde (\fB~\fR), the shell attempts
207 completion with a user name, rather than a file in the working directory.
210 The terminal bell signals errors or multiple matches. This bell signal can be
211 inhibited by setting the variable \fBnobeep\fR. You can exclude files with
212 certain suffixes by listing those suffixes in the variable \fBfignore\fR. If,
213 however, the only possible completion includes a suffix in the list, it is not
214 ignored. \fBfignore\fR does not affect the listing of filenames by the
215 \fBEOF\fR character.
216 .SS "Lexical Structure"
218 The shell splits input lines into words at space and tab characters, except as
219 noted below. The characters \fB&\fR, \fB|\fR, \fB;\fR, \fB<\fR, \fB>\fR,
220 \fB(\fR, and \fB)\fR form separate words; if paired, the pairs form single
221 words. These shell metacharacters can be made part of other words, and their
222 special meaning can be suppressed by preceding them with a `\fB\e\fR\&'
223 (backslash). A newline preceded by a \fB\e\fR is equivalent to a space
224 character.
227 In addition, a string enclosed in matched pairs of single-quotes (\fB\&'\fR),
228 double-quotes (\fB"\fR), or backquotes (\fB`\fR), forms a partial word.
229 Metacharacters in such a string, including any space or tab characters, do not
230 form separate words. Within pairs of backquote (\fB`\fR) or double-quote
231 (\fB"\fR) characters, a newline preceded by a `\fB\e\fR\&' (backslash) gives a
232 true newline character. Additional functions of each type of quote are
233 described, below, under \fBVariable Substitution\fR, \fBCommand
234 Substitution\fR, and \fBFilename\fR \fBSubstitution\fR.
237 When the shell's input is not a terminal, the character \fB#\fR introduces a
238 comment that continues to the end of the input line. Its special meaning is
239 suppressed when preceded by a \fB\e\fR or enclosed in matching quotes.
240 .SS "Command Line Parsing"
242 A \fIsimple command\fR is composed of a sequence of words. The first word (that
243 is not part of an I/O redirection) specifies the command to be executed. A
244 simple command, or a set of simple commands separated by \fB|\fR or \fB|&\fR
245 characters, forms a \fIpipeline\fR. With \fB|\fR, the standard output of the
246 preceding command is redirected to the standard input of the command that
247 follows. With \fB|\|&\fR, both the standard error and the standard output are
248 redirected through the pipeline.
251 Pipelines can be separated by semicolons (\|\fB;\fR\|), in which case they are
252 executed sequentially. Pipelines that are separated by \fB&&\fR or \fB|\||\fR
253 form conditional sequences in which the execution of pipelines on the right
254 depends upon the success or failure, respectively, of the pipeline on the left.
257 A pipeline or sequence can be enclosed within parentheses `()' to form a simple
258 command that can be a component in a pipeline or sequence.
261 A sequence of pipelines can be executed asynchronously or "in the background"
262 by appending an `\fB&\fR\&'; rather than waiting for the sequence to finish
263 before issuing a prompt, the shell displays the job number (see \fBJob
264 Control\fR, below) and associated process IDs and prompts immediately.
265 .SS "History Substitution"
267 History substitution allows you to use words from previous command lines in the
268 command line you are typing. This simplifies spelling corrections and the
269 repetition of complicated commands or arguments. Command lines are saved in the
270 history list, the size of which is controlled by the \fBhistory\fR variable.
271 The most recent command is retained in any case. A history substitution begins
272 with a \fB!\fR (although you can change this with the \fBhistchars\fR variable)
273 and occurs anywhere on the command line; history substitutions do not nest. The
274 \fB!\fR can be escaped with \fB\e\fR to suppress its special meaning.
277 Input lines containing history substitutions are echoed on the terminal after
278 being expanded, but before any other substitutions take place or the command
279 gets executed.
280 .SS "Event Designators"
282 An event designator is a reference to a command line entry in the history list.
284 .ne 2
286 \fB\fB!\fR\fR
288 .sp .6
289 .RS 4n
290 Start a history substitution, except when followed by a space character, tab,
291 newline, \fB=\fR or \fB(\fR.
295 .ne 2
297 \fB\fB!!\fR\fR
299 .sp .6
300 .RS 4n
301 Refer to the previous command. By itself, this substitution repeats the
302 previous command.
306 .ne 2
308 \fB\fB!\fR\fIn\fR\fR
310 .sp .6
311 .RS 4n
312 Refer to command line \fIn\fR.
316 .ne 2
318 \fB\fB!\fR\fB-n\fR\fR
320 .sp .6
321 .RS 4n
322 Refer to the current command line minus \fIn\fR.
326 .ne 2
328 \fB\fB!\fR\fIstr\fR\fR
330 .sp .6
331 .RS 4n
332 Refer to the most recent command starting with \fIstr\fR.
336 .ne 2
338 \fB\fB!?\fR\fIstr\fR\fB?\fR\fR
340 .sp .6
341 .RS 4n
342 Refer to the most recent command containing \fIstr\fR.
346 .ne 2
348 \fB\fB!?\fR\fIstr\fR\fB?\fR \fIadditional\fR\fR
350 .sp .6
351 .RS 4n
352 Refer to the most recent command containing \fIstr\fR and append
353 \fIadditional\fR to that referenced command.
357 .ne 2
359 \fB\fB!{\fR\fIcommand\fR\fB}\fR \fIadditional\fR\fR
361 .sp .6
362 .RS 4n
363 Refer to the most recent command beginning with \fIcommand\fR and append
364 \fIadditional\fR to that referenced command.
368 .ne 2
370 \fB\fB^\fR\fIprevious_word\fR\fB^\fR\fIreplacement\fR\fB^\fR\fR
372 .sp .6
373 .RS 4n
374 Repeat the previous command line replacing the string \fIprevious_word\fR with
375 the string \fIreplacement\fR. This is equivalent to the history substitution:
377 .in +2
379 !:s/\fIprevious_word\fR/\fIreplacement\fR/.
381 .in -2
384 To re-execute a specific previous command AND make such a substitution, say,
385 re-executing command #6,
387 .in +2
389 !:6s/\fIprevious_word\fR/\fIreplacement\fR/.
391 .in -2
396 .SS "Word Designators"
398 A `\fB:\fR' (colon) separates the event specification from the word designator.
399 It can be omitted if the word designator begins with a \fB^\fR, \fB$\fR,
400 \fB*\fR, \fB\(mi\fR or \fB%\fR. If the word is to be selected from the previous
401 command, the second \fB!\fR character can be omitted from the event
402 specification. For instance, \fB!!:1\fR and \fB!:1\fR both refer to the first
403 word of the previous command, while \fB!!$\fR and \fB!$\fR both refer to the
404 last word in the previous command. Word designators include:
406 .ne 2
408 \fB\fB#\fR\fR
410 .RS 10n
411 The entire command line typed so far.
415 .ne 2
417 \fB\fB0\fR\fR
419 .RS 10n
420 The first input word (command).
424 .ne 2
426 \fB\fIn\fR\fR
428 .RS 10n
429 The \fIn\fR'th argument.
433 .ne 2
435 \fB\fB^\fR\fR
437 .RS 10n
438 The first argument, that is, \fB1\fR.
442 .ne 2
444 \fB\fB$\fR\fR
446 .RS 10n
447 The last argument.
451 .ne 2
453 \fB\fB%\fR\fR
455 .RS 10n
456 The word matched by the \fB?\fR\fIs\fR search.
460 .ne 2
462 \fB\fIx\fR\fB\(mi\fR\fIy\fR\fR
464 .RS 10n
465 A range of words; \fB\(mi\fR\fIy\fR abbreviates \fB0\(mi\fR\fIy\fR.
469 .ne 2
471 \fB\fB*\fR\fR
473 .RS 10n
474 All the arguments, or a null value if there is just one word in the event.
478 .ne 2
480 \fB\fIx\fR\fB*\fR\fR
482 .RS 10n
483 Abbreviates \fIx\fR\fB\(mi$\fR\fI\&.\fR
487 .ne 2
489 \fB\fIx\fR\fB\(mi\fR\fR
491 .RS 10n
492 Like \fIx*\fR but omitting word \fB$\fR.
495 .SS "Modifiers"
497 After the optional word designator, you can add one of the following modifiers,
498 preceded by a \fB:\fR.
500 .ne 2
502 \fB\fBh\fR\fR
504 .RS 10n
505 Remove a trailing pathname component, leaving the head.
509 .ne 2
511 \fB\fBr\fR\fR
513 .RS 10n
514 Remove a trailing suffix of the form `\fB\&.\fR\fIxxx\fR', leaving the
515 basename.
519 .ne 2
521 \fB\fBe\fR\fR
523 .RS 10n
524 Remove all but the suffix, leaving the Extension.
528 .ne 2
530 \fB\fBs/\fR\fIl\fR\fB/\fR\fIr\fR\fB/\fR\fR
532 .RS 10n
533 Substitute \fIr\fR for \fIl\fR.
537 .ne 2
539 \fB\fBt\fR\fR
541 .RS 10n
542 Remove all leading pathname components, leaving the tail.
546 .ne 2
548 \fB\fB&\fR\fR
550 .RS 10n
551 Repeat the previous substitution.
555 .ne 2
557 \fB\fBg\fR\fR
559 .RS 10n
560 Apply the change to the first occurrence of a match in each word, by prefixing
561 the above (for example, \fBg&\fR).
565 .ne 2
567 \fB\fBp\fR\fR
569 .RS 10n
570 Print the new command but do not execute it.
574 .ne 2
576 \fB\fBq\fR\fR
578 .RS 10n
579 Quote the substituted words,escaping further substitutions.
583 .ne 2
585 \fB\fBx\fR\fR
587 .RS 10n
588 Like \fBq\fR, but break into words at each space character, tab or newline.
593 Unless preceded by a \fBg\fR, the modification is applied only to the first
594 string that matches \fIl\fR; an error results if no string matches.
597 The left-hand side of substitutions are not regular expressions, but character
598 strings. Any character can be used as the delimiter in place of \fB/\fR. A
599 backslash quotes the delimiter character. The character \fB&\fR, in the right
600 hand side, is replaced by the text from the left-hand-side. The \fB&\fR can be
601 quoted with a backslash. A null \fIl\fR uses the previous string either from a
602 \fIl\fR or from a contextual scan string \fIs\fR from \fB!?\fR\fIs\fR. You can
603 omit the rightmost delimiter if a newline immediately follows \fIr\fR; the
604 rightmost \fB?\fR in a context scan can similarly be omitted.
607 Without an event specification, a history reference refers either to the
608 previous command, or to a previous history reference on the command line (if
609 any).
610 .SS "Quick Substitution"
611 .ne 2
613 \fB\fB^\fR\fIl\fR\fB^\fR\fIr\fR\fB^\fR\fR
615 .RS 9n
616 This is equivalent to the history substitution:
618 .in +2
620 !:s/\fIl\fR/\fIr\fR/.
622 .in -2
627 .SS "Aliases"
629 The C shell maintains a list of aliases that you can create, display, and
630 modify using the \fBalias\fR and \fBunalias\fR commands. The shell checks the
631 first word in each command to see if it matches the name of an existing alias.
632 If it does, the command is reprocessed with the alias definition replacing its
633 name; the history substitution mechanism is made available as though that
634 command were the previous input line. This allows history substitutions,
635 escaped with a backslash in the definition, to be replaced with actual command
636 line arguments when the alias is used. If no history substitution is called
637 for, the arguments remain unchanged.
640 Aliases can be nested. That is, an alias definition can contain the name of
641 another alias. Nested aliases are expanded before any history substitutions is
642 applied. This is useful in pipelines such as
644 .in +2
646 \fBalias lm 'ls -l \e!* | more'\fR
648 .in -2
653 which when called, pipes the output of \fBls\fR(1) through \fBmore\fR(1).
656 Except for the first word, the name of the alias can not appear in its
657 definition, nor in any alias referred to by its definition. Such loops are
658 detected, and cause an error message.
659 .SS "I/O Redirection"
661 The following metacharacters indicate that the subsequent word is the name of a
662 file to which the command's standard input, standard output, or standard error
663 is redirected; this word is variable, command, and filename expanded separately
664 from the rest of the command.
666 .ne 2
668 \fB\fB<\fR\fR
670 .RS 15n
671 Redirect the standard input.
675 .ne 2
677 \fB\fB<\|<\fR\fI\|word\fR\fR
679 .RS 15n
680 Read the standard input, up to a line that is identical with \fIword\fR, and
681 place the resulting lines in a temporary file. Unless \fIword\fR is escaped or
682 quoted, variable and command substitutions are performed on these lines. Then,
683 the pipeline is invoked with the temporary file as its standard input.
684 \fIword\fR is not subjected to variable, filename, or command substitution, and
685 each line is compared to it before any substitutions are performed by the
686 shell.
690 .ne 2
692 \fB\fB>\fR \fB>!\fR \fB>&\fR \fB>&!\fR\fR
694 .RS 15n
695 Redirect the standard output to a file. If the file does not exist, it is
696 created. If it does exist, it is overwritten; its previous contents are lost.
698 When set, the variable \fBnoclobber\fR prevents destruction of existing files.
699 It also prevents redirection to terminals and \fB/dev/null\fR, unless one of
700 the \fB!\fR forms is used. The \fB&\fR forms redirect both standard output and
701 the standard error (diagnostic output) to the file.
705 .ne 2
707 \fB\fB>\|>\fR \fB>\|>&\fR \fB>\|>!\fR \fB>\|>&!\fR\fR
709 .RS 27n
710 Append the standard output. Like \fB>\fR, but places output at the end of the
711 file rather than overwriting it. If \fBnoclobber\fR is set, it is an error for
712 the file not to exist, unless one of the \fB!\fR forms is used. The \fB&\fR
713 forms append both the standard error and standard output to the file.
716 .SS "Variable Substitution"
718 The C shell maintains a set of variables, each of which is composed of a
719 \fIname\fR and a \fIvalue\fR. A variable name consists of up to 128 letters and
720 digits, and starts with a letter. An underscore (\fB_\fR) is considered a
721 letter). A variable's value is a space-separated list of zero or more words. If
722 the shell supports a variable name up to 128 characters the variable
723 \fBSUNW_VARLEN\fR is defined. If a variable name of up to 128 characters is not
724 supported, then an older version of the shell is being used, and the shell
725 variable name length has a maximum length of 20.
728 To refer to a variable's value, precede its name with a `\fB$\fR'. Certain
729 references (described below) can be used to select specific words from the
730 value, or to display other information about the variable. Braces can be used
731 to insulate the reference from other characters in an input-line word.
734 Variable substitution takes place after the input line is analyzed, aliases are
735 resolved, and I/O redirections are applied. Exceptions to this are variable
736 references in I/O redirections (substituted at the time the redirection is
737 made), and backquoted strings (see Command Substitution).
740 Variable substitution can be suppressed by preceding the \fB$\fR with a
741 \fB\e\fR, except within double-quotes where it always occurs. Variable
742 substitution is suppressed inside of single-quotes. A \fB$\fR is escaped if
743 followed by a space character, tab or newline.
746 Variables can be created, displayed, or destroyed using the \fBset\fR and
747 \fBunset\fR commands. Some variables are maintained or used by the shell. For
748 instance, the \fBargv\fR variable contains an image of the shell's argument
749 list. Of the variables used by the shell, a number are toggles; the shell does
750 not care what their value is, only whether they are set or not.
753 Numerical values can be operated on as numbers (as with the \fB@\fR built-in
754 command). With numeric operations, an empty value is considered to be zero. The
755 second and subsequent words of multiword values are ignored. For instance, when
756 the \fBverbose\fR variable is set to any value (including an empty value),
757 command input is echoed on the terminal.
760 Command and filename substitution is subsequently applied to the words that
761 result from the variable substitution, except when suppressed by double-quotes,
762 when \fBnoglob\fR is set (suppressing filename substitution), or when the
763 reference is quoted with the \fB:q\fR modifier. Within double-quotes, a
764 reference is expanded to form (a portion of) a quoted string; multiword values
765 are expanded to a string with embedded space characters. When the \fB:q\fR
766 modifier is applied to the reference, it is expanded to a list of
767 space-separated words, each of which is quoted to prevent subsequent command or
768 filename substitutions.
771 Except as noted below, it is an error to refer to a variable that is not set.
773 .ne 2
775 \fB\fB$\fR\fIvar\fR\fR
779 \fB\fB${\fR\fIvar\fR\fB}\fR\fR
781 .RS 17n
782 These are replaced by words from the value of \fIvar\fR, each separated by a
783 space character. If \fIvar\fR is an environment variable, its value is returned
784 (but `\fB:\fR' modifiers and the other forms given below are not available).
788 .ne 2
790 \fB\fB$\fR\fIvar\fR\fB[\fR\fIindex\fR\fB]\fR\fR
794 \fB\fB${\fR\fIvar\fR\fB[\fR\fIindex\fR\fB]}\fR\fR
796 .RS 17n
797 These select only the indicated words from the value of \fIvar\fR. Variable
798 substitution is applied to \fIindex\fR\|, which can consist of (or result in) a
799 either single number, two numbers separated by a `\fB\(mi\fR\&', or an
800 asterisk. Words are indexed starting from 1; a `\fB*\fR' selects all words. If
801 the first number of a range is omitted (as with \fB$argv[\(mi2]\fR), it
802 defaults to 1. If the last number of a range is omitted (as with
803 \fB$argv[1\(mi]\fR), it defaults to \fB$#\fR\fIvar\fR (the word count). It is
804 not an error for a range to be empty if the second argument is omitted (or
805 within range).
809 .ne 2
811 \fB\fB$#\fR\fIname\fR\fR
815 \fB\fB${#\fR\fIname\fR\fB}\fR\fR
817 .RS 17n
818 These give the number of words in the variable.
822 .ne 2
824 \fB\fB$0\fR\fR
826 .RS 17n
827 This substitutes the name of the file from which command input is being read
828 except for setuid shell scripts. An error occurs if the name is not known.
832 .ne 2
834 \fB\fB$\fR\fIn\fR\fR
838 \fB\fB${\fR\fIn\fR\fB}\fR\fR
840 .RS 17n
841 Equivalent to \fB$argv[\fR\fIn\fR\fB]\fR\fI\&.\fR
845 .ne 2
847 \fB\fB$*\fR\fR
849 .RS 17n
850 Equivalent to \fB$argv[*]\fR.
855 The modifiers \fB:e\fR, \fB:h\fR, \fB:q\fR, \fB:r\fR, \fB:t\fR, and \fB:x\fR
856 can be applied (see \fBHistory\fR \fBSubstitution\fR), as can \fB:gh\fR,
857 \fB:gt\fR, and \fB:gr\fR. If \fB{\|}\fR (braces) are used, then the modifiers
858 must appear within the braces. The current implementation allows only one such
859 modifier per expansion.
862 The following references can not be modified with \fB:\fR modifiers.
864 .ne 2
866 \fB\fB$?\fR\fIvar\fR\fR
870 \fB\fB${?\fR\fIvar\fR\fB}\fR\fR
872 .RS 11n
873 Substitutes the string 1 if \fIvar\fR is set or 0 if it is not set.
877 .ne 2
879 \fB\fB$?0\fR\fR
881 .RS 11n
882 Substitutes 1 if the current input filename is known or 0 if it is not.
886 .ne 2
888 \fB\fB$$\fR\fR
890 .RS 11n
891 Substitutes the process number of the (parent) shell.
895 .ne 2
897 \fB\fB$<\fR\fR
899 .RS 11n
900 Substitutes a line from the standard input, with no further interpretation
901 thereafter. It can be used to read from the keyboard in a C shell script.
904 .SS "Command and Filename Substitutions"
906 Command and filename substitutions are applied selectively to the arguments of
907 built-in commands. Portions of expressions that are not evaluated are not
908 expanded. For non-built-in commands, filename expansion of the command name is
909 done separately from that of the argument list; expansion occurs in a subshell,
910 after I/O redirection is performed.
911 .SS "Command Substitution"
913 A command enclosed by backquotes (\|\fB`\fR\|.\|.\|.\|\fB`\fR\|) is performed
914 by a subshell. Its standard output is broken into separate words at each space
915 character, tab and newline; null words are discarded. This text replaces the
916 backquoted string on the current command line. Within double-quotes, only
917 newline characters force new words; space and tab characters are preserved.
918 However, a final newline is ignored. It is therefore possible for a command
919 substitution to yield a partial word.
920 .SS "Filename Substitution"
922 Unquoted words containing any of the characters \fB*\fR, \fB?\fR, \fB[\fR or
923 \fB{\fR, or that begin with ~, are expanded (also known as \fIglobbing\fR) to
924 an alphabetically sorted list of filenames, as follows:
926 .ne 2
928 \fB*\fR
930 .RS 24n
931 Match any (zero or more) characters.
935 .ne 2
937 \fB?\fR
939 .RS 24n
940 Match any single character.
944 .ne 2
946 \fB\fB[\fR.\|.\|.\fB]\fR\fR
948 .RS 24n
949 Match any single character in the enclosed list(s) or range(s). A list is a
950 string of characters. A range is two characters separated by a dash
951 (\fB\(mi\fR), and includes all the characters in between in the \fBASCII\fR
952 collating sequence (see \fBascii\fR(5)).
956 .ne 2
958 \fB{\fIstr\fR\fB,\fR \fIstr\fR\fB,\fR .\|.\|. \fB}\fR\fR
960 .RS 24n
961 Expand to each string (or filename-matching pattern) in the comma-separated
962 list. Unlike the pattern-matching expressions above, the expansion of this
963 construct is not sorted. For instance, \fB{b,a}\fR expands to `\fBb\fR'
964 `\fBa\fR', (not `\fBa\fR' `\fBb\fR'). As special cases, the characters \fB{\fR
965 and \fB}\fR, along with the string \fB{\|}\fR, are passed undisturbed.
969 .ne 2
971 \fB~[\fIuser\fR]\fR
973 .RS 24n
974 Your home directory, as indicated by the value of the variable \fBhome\fR, or
975 that of \fIuser\fR, as indicated by the password entry for \fIuser\fR.
980 Only the patterns \fB*\fR, \fB?\fR and \fB[\fR.\|.\|.\fB]\fR imply pattern
981 matching; an error results if no filename matches a pattern that contains them.
982 The `\fB\&.\fR' (dot character), when it is the first character in a filename
983 or pathname component, must be matched explicitly. The \fB/\fR (slash) must
984 also be matched explicitly.
985 .SS "Expressions and Operators"
987 A number of C shell built-in commands accept expressions, in which the
988 operators are similar to those of C and have the same precedence. These
989 expressions typically appear in the \fB@\fR, \fBexit\fR, \fBif\fR, \fBset\fR
990 and \fBwhile\fR commands, and are often used to regulate the flow of control
991 for executing commands. Components of an expression are separated by white
992 space.
995 Null or missing values are considered \fB0\fR. The result of all expressions is
996 a string, which can represent decimal numbers.
999 The following C shell operators are grouped in order of precedence:
1001 .ne 2
1003 \fB\fB(\|\fR.\|.\|.\|\fB\|)\fR\fR
1005 .RS 19n
1006 grouping
1010 .ne 2
1012 \fB>\fB~\fR\fR
1014 .RS 19n
1015 one's complement
1019 .ne 2
1021 \fB\fB!\fR\fR
1023 .RS 19n
1024 logical negation
1028 .ne 2
1030 \fB\fB* / %\fR\fR
1032 .RS 19n
1033 multiplication, division, remainder. These are right associative, which can
1034 lead to unexpected results. Combinations should be grouped explicitly with
1035 parentheses.
1039 .ne 2
1041 \fB\fB+ \(mi\fR\fR
1043 .RS 19n
1044 addition, subtraction (also right associative)
1048 .ne 2
1050 \fB\fB<< >>\fR\fR
1052 .RS 19n
1053 bitwise shift left, bitwise shift right
1057 .ne 2
1059 \fB\fB< > <= >=\fR\fR
1061 .RS 19n
1062 less than, greater than, less than or equal to, greater than or equal to
1066 .ne 2
1068 \fB\fB=\|= != =~ !~\fR\fR
1070 .RS 19n
1071 equal to, not equal to, filename-substitution pattern match (described below),
1072 filename-substitution pattern mismatch
1076 .ne 2
1078 \fB\fB&\fR\fR
1080 .RS 19n
1081 bitwise AND
1085 .ne 2
1087 \fB\fB^\fR\fR
1089 .RS 19n
1090 bitwise XOR (exclusive or)
1094 .ne 2
1096 \fB\fB|\fR\fR
1098 .RS 19n
1099 bitwise inclusive OR
1103 .ne 2
1105 \fB\fB&&\fR\fR
1107 .RS 19n
1108 logical AND
1112 .ne 2
1114 \fB\fB|\|\||\fR\fR
1116 .RS 19n
1117 logical OR
1122 The operators: \fB==\fR, \fB!=\fR, \fB=~\fR, and \fB!~\fR compare their
1123 arguments as strings; other operators use numbers. The operators \fB=~\fR and
1124 \fB!~\fR each check whether or not a string to the left matches a filename
1125 substitution pattern on the right. This reduces the need for \fBswitch\fR
1126 statements when pattern-matching between strings is all that is required.
1129 Also available are file inquiries:
1131 .ne 2
1133 \fB\fB-r\fR\fIfilename\fR\fR
1135 .RS 15n
1136 Return true, or 1 if the user has read access. Otherwise it returns false, or
1141 .ne 2
1143 \fB\fB-w\fR\fIfilename\fR\fR
1145 .RS 15n
1146 True if the user has write access.
1150 .ne 2
1152 \fB\fB-x\fR\fIfilename\fR\fR
1154 .RS 15n
1155 True if the user has execute permission (or search permission on a directory).
1159 .ne 2
1161 \fB\fB-e\fR\fIfilename\fR\fR
1163 .RS 15n
1164 True if \fIfilename\fR exists.
1168 .ne 2
1170 \fB\fB-o\fR\fIfilename\fR\fR
1172 .RS 15n
1173 True if the user owns \fIfilename\fR.
1177 .ne 2
1179 \fB\fB-z\fR \fIfilename\fR\fR
1181 .RS 15n
1182 True if \fIfilename\fR is of zero length (empty).
1186 .ne 2
1188 \fB\fB-f\fR\fIfilename\fR\fR
1190 .RS 15n
1191 True if \fIfilename\fR is a plain file.
1195 .ne 2
1197 \fB\fB-d\fR\fIfilename\fR\fR
1199 .RS 15n
1200 True if \fIfilename\fR is a directory.
1205 If \fIfilename\fR does not exist or is inaccessible, then all inquiries return
1206 false.
1209 An inquiry as to the success of a command is also available:
1211 .ne 2
1213 \fB\fB{\fR \fIcommand\fR\fB}\fR\fR
1215 .RS 14n
1216 If \fIcommand\fR runs successfully, the expression evaluates to true, 1.
1217 Otherwise, it evaluates to false, 0. \fBNote:\fR Conversely, \fIcommand\fR
1218 itself typically returns 0 when it runs successfully, or some other value if it
1219 encounters a problem. If you want to get at the status directly, use the value
1220 of the \fBstatus\fR variable rather than this expression.
1223 .SS "Control Flow"
1225 The shell contains a number of commands to regulate the flow of control in
1226 scripts and within limits, from the terminal. These commands operate by forcing
1227 the shell either to reread input (to \fIloop\fR), or to skip input under
1228 certain conditions (to \fIbranch\fR).
1231 Each occurrence of a \fBforeach\fR, \fBswitch\fR, \fBwhile\fR,
1232 \fBif\fR.\|.\|.\fBthen\fR and \fBelse\fR built-in command must appear as the
1233 first word on its own input line.
1236 If the shell's input is not seekable and a loop is being read, that input is
1237 buffered. The shell performs seeks within the internal buffer to accomplish the
1238 rereading implied by the loop. (To the extent that this allows, backward
1239 \fBgoto\fR commands succeeds on nonseekable inputs.)
1240 .SS "Command Execution"
1242 If the command is a C shell built-in command, the shell executes it directly.
1243 Otherwise, the shell searches for a file by that name with execute access. If
1244 the command name contains a \fB/\fR, the shell takes it as a pathname, and
1245 searches for it. If the command name does not contain a \fB/\fR, the shell
1246 attempts to resolve it to a pathname, searching each directory in the
1247 \fBpath\fR variable for the command. To speed the search, the shell uses its
1248 hash table (see the \fBrehash\fR built-in command) to eliminate directories
1249 that have no applicable files. This hashing can be disabled with the \fB-c\fR
1250 or \fB-t\fR, options, or the \fBunhash\fR built-in command.
1253 As a special case, if there is no \fB/\fR in the name of the script and there
1254 is an alias for the word \fBshell\fR, the expansion of the \fBshell\fR alias is
1255 prepended (without modification) to the command line. The system attempts to
1256 execute the first word of this special (late-occurring) alias, which should be
1257 a full pathname. Remaining words of the alias's definition, along with the text
1258 of the input line, are treated as arguments.
1261 When a pathname is found that has proper execute permissions, the shell forks a
1262 new process and passes it, along with its arguments, to the kernel using the
1263 \fBexecve\fR(\|) system call (see \fBexec\fR(2)). The kernel then attempts to
1264 overlay the new process with the desired program. If the file is an executable
1265 binary (in \fBa.out\fR(4) format) the kernel succeeds and begins executing the
1266 new process. If the file is a text file and the first line begins with
1267 \fB#!\fR, the next word is taken to be the pathname of a shell (or command) to
1268 interpret that script. Subsequent words on the first line are taken as options
1269 for that shell. The kernel invokes (overlays) the indicated shell, using the
1270 name of the script as an argument.
1273 If neither of the above conditions holds, the kernel cannot overlay the file
1274 and the \fBexecve\fR(\|) call fails (see \fBexec\fR(2)). The C shell then
1275 attempts to execute the file by spawning a new shell, as follows:
1276 .RS +4
1278 .ie t \(bu
1279 .el o
1280 If the first character of the file is a \fB#\fR, a C shell is invoked.
1282 .RS +4
1284 .ie t \(bu
1285 .el o
1286 Otherwise, a Bourne shell is invoked.
1288 .SS "Signal Handling"
1290 The shell normally ignores \fBQUIT\fR signals. Background jobs are immune to
1291 signals generated from the keyboard, including hangups (\fBHUP\fR). Other
1292 signals have the values that the C shell inherited from its environment. The
1293 shell's handling of interrupt and terminate signals within scripts can be
1294 controlled by the \fBonintr\fR built-in command. Login shells catch the
1295 \fBTERM\fR signal. Otherwise, this signal is passed on to child processes. In
1296 no case are interrupts allowed when a login shell is reading the
1297 \fB\&.logout\fR file.
1298 .SS "Job Control"
1300 The shell associates a numbered \fIjob\fR with each command sequence to keep
1301 track of those commands that are running in the background or have been stopped
1302 with \fBTSTP\fR signals (typically Control-z). When a command or command
1303 sequence (semicolon separated list) is started in the background using the
1304 \fB&\fR metacharacter, the shell displays a line with the job number in
1305 brackets and a list of associated process numbers:
1307 .in +2
1309 [1] 1234
1311 .in -2
1316 To see the current list of jobs, use the \fBjobs\fR built-in command. The job
1317 most recently stopped (or put into the background if none are stopped) is
1318 referred to as the \fIcurrent\fR job and is indicated with a `\fB+\fR'. The
1319 previous job is indicated with a `\fB\(mi\fR\&'. When the current job is
1320 terminated or moved to the foreground, this job takes its place (becomes the
1321 new current job).
1324 To manipulate jobs, refer to the \fBbg\fR, \fBfg\fR, \fBkill\fR, \fBstop\fR,
1325 and \fB%\fR built-in commands.
1328 A reference to a job begins with a `\fB%\fR'. By itself, the percent-sign
1329 refers to the current job.
1331 .ne 2
1333 \fB\fB%\fR \fB%+\fR \fB%%\fR\fR
1335 .RS 12n
1336 The current job.
1340 .ne 2
1342 \fB\fB%\(mi\fR\fR
1344 .RS 12n
1345 The previous job.
1349 .ne 2
1351 \fB\fB%\fR\fIj\fR\fR
1353 .RS 12n
1354 Refer to job \fIj\fR as in: `\fBkill\fR \fB-9\fR \fB%\fR\fIj\fR'. \fIj\fR can
1355 be a job number, or a string that uniquely specifies the command line by which
1356 it was started; `\fBfg %vi\fR' might bring a stopped \fBvi\fR job to the
1357 foreground, for instance.
1361 .ne 2
1363 \fB\fB%?\fR\fIstring\fR\fR
1365 .RS 12n
1366 Specify the job for which the command line uniquely contains \fIstring\fR.
1371 A job running in the background stops when it attempts to read from the
1372 terminal. Background jobs can normally produce output, but this can be
1373 suppressed using the `\fBstty tostop\fR' command.
1374 .SS "Status Reporting"
1376 While running interactively, the shell tracks the status of each job and
1377 reports whenever the job finishes or becomes blocked. It normally displays a
1378 message to this effect as it issues a prompt, in order to avoid disturbing the
1379 appearance of your input. When set, the \fBnotify\fR variable indicates that
1380 the shell is to report status changes immediately. By default, the \fBnotify\fR
1381 command marks the current process; after starting a background job, type
1382 \fBnotify\fR to mark it.
1383 .SS "Commands"
1385 Built-in commands are executed within the C shell. If a built-in command occurs
1386 as any component of a pipeline except the last, it is executed in a subshell.
1388 .ne 2
1390 \fB\fB:\fR\fR
1392 .RS 26n
1393 Null command. This command is interpreted, but performs no action.
1397 .ne 2
1399 \fB\fBalias\fR [ \fIname\fR [ \fIdef\fR ] ]\fR
1401 .RS 26n
1402 Assign \fIdef\fR to the alias \fIname\fR. \fIdef\fR is a list of words that can
1403 contain escaped history-substitution metasyntax. \fIname\fR is not allowed to
1404 be \fBalias\fR or \fBunalias\fR. If \fIdef\fR is omitted, the current
1405 definition for the alias \fIname\fR is displayed. If both \fIname\fR and
1406 \fIdef\fR are omitted, all aliases are displayed with their definitions.
1410 .ne 2
1412 \fB\fBbg\fR [ \fB%\fR\fIjob .\|.\|.\fR ]\fR
1414 .RS 26n
1415 Run the current or specified jobs in the background.
1419 .ne 2
1421 \fB\fBbreak\fR\fR
1423 .RS 26n
1424 Resume execution after the \fBend\fR of the nearest enclosing \fBforeach\fR or
1425 \fBwhile\fR loop. The remaining commands on the current line are executed. This
1426 allows multilevel breaks to be written as a list of \fBbreak\fR commands, all
1427 on one line.
1431 .ne 2
1433 \fB\fBbreaksw\fR\fR
1435 .RS 26n
1436 Break from a \fBswitch\fR, resuming after the \fBendsw\fR.
1440 .ne 2
1442 \fB\fBcase\fR \fIlabel\fR\fB:\fR\fR
1444 .RS 26n
1445 A label in a \fBswitch\fR statement.
1449 .ne 2
1451 \fB\fBcd\fR [\fIdir\fR ]\fR
1455 \fB\fBchdir\fR [\fIdir\fR ]\fR
1457 .RS 26n
1458 Change the shell's working directory to directory \fIdir\fR. If no argument is
1459 given, change to the home directory of the user. If \fIdir\fR is a relative
1460 pathname not found in the current directory, check for it in those directories
1461 listed in the \fBcdpath\fR variable. If \fIdir\fR is the name of a shell
1462 variable whose value starts with a \fB/\fR, change to the directory named by
1463 that value.
1467 .ne 2
1469 \fB\fBcontinue\fR\fR
1471 .RS 26n
1472 Continue execution of the next iteration of the nearest enclosing \fBwhile\fR
1473 or \fBforeach\fR loop.
1477 .ne 2
1479 \fB\fBdefault:\fR\fR
1481 .RS 26n
1482 Labels the default case in a \fBswitch\fR statement. The default should come
1483 after all \fBcase\fR labels. Any remaining commands on the command line are
1484 first executed.
1488 .ne 2
1490 \fB\fBdirs\fR [\fB-l\fR]\fR
1492 .RS 26n
1493 Print the directory stack, most recent to the left. The first directory shown
1494 is the current directory. With the \fB-l\fR argument, produce an unabbreviated
1495 printout; use of the ~ notation is suppressed.
1499 .ne 2
1501 \fB\fBecho\fR [\fB-n\fR] \fIlist\fR\fR
1503 .RS 26n
1504 The words in \fIlist\fR are written to the shell's standard output, separated
1505 by space characters. The output is terminated with a newline unless the
1506 \fB-n\fR option is used. \fBcsh\fR, by default, invokes its built-in
1507 \fBecho\fR, if \fBecho\fR is called without the full pathname of a Unix
1508 command, regardless of the configuration of your \fBPATH\fR (see
1509 \fBecho\fR(1)).
1513 .ne 2
1515 \fB\fBeval\fR \fIargument\fR\fB\|.\|.\|.\fR\fR
1517 .RS 26n
1518 Reads the arguments as input to the shell and executes the resulting
1519 command(s). This is usually used to execute commands generated as the result of
1520 command or variable substitution. See \fBtset\fR(1B) for an example of how to
1521 use \fBeval\fR.
1525 .ne 2
1527 \fB\fBexec\fR \fIcommand\fR\fR
1529 .RS 26n
1530 Execute \fIcommand\fR in place of the current shell, which terminates.
1534 .ne 2
1536 \fB\fBexit\fR [\fB(\fR\fIexpr\fR\fB)\fR]\fR
1538 .RS 26n
1539 The calling shell or shell script exits, either with the value of the status
1540 variable or with the value specified by the expression \fIexpr\fR.
1544 .ne 2
1546 \fB\fBfg\fR [\fB%\fR\fIjob\fR ]\fR
1548 .RS 26n
1549 Bring the current or specified \fIjob\fR into the foreground.
1553 .ne 2
1555 \fB\fBforeach\fR \fIvar\fR\fB(\fR\fIwordlist\fR\fB)\fR\fR
1559 \fB\&.\|.\|.\fR
1563 \fB\fBend\fR\fR
1565 .RS 26n
1566 The variable \fIvar\fR is successively set to each member of \fIwordlist\fR.
1567 The sequence of commands between this command and the matching \fBend\fR is
1568 executed for each new value of \fIvar\fR. Both \fBforeach\fR and \fBend\fR must
1569 appear alone on separate lines.
1571 The built-in command \fBcontinue\fR can be used to terminate the execution of
1572 the current iteration of the loop and the built-in command \fBbreak\fR can be
1573 used to terminate execution of the \fBforeach\fR command. When this command is
1574 read from the terminal, the loop is read once prompting with \fB?\fR before any
1575 statements in the loop are executed.
1579 .ne 2
1581 \fB\fBglob\fR \fIwordlist\fR\fR
1583 .sp .6
1584 .RS 4n
1585 Perform filename expansion on \fIwordlist\fR. Like \fBecho\fR, but no \fB\e\fR
1586 escapes are recognized. Words are delimited by \fINULL\fR characters in the
1587 output.
1591 .ne 2
1593 \fB\fBgoto\fR\fIlabel\fR\fR
1595 .sp .6
1596 .RS 4n
1597 The specified \fIlabel\fR is a filename and a command expanded to yield a
1598 label. The shell rewinds its input as much as possible and searches for a line
1599 of the form \fIlabel\fR\fB:\fR possibly preceded by space or tab characters.
1600 Execution continues after the indicated line. It is an error to jump to a label
1601 that occurs between a \fBwhile\fR or \fBfor\fR built-in command and its
1602 corresponding \fBend\fR.
1606 .ne 2
1608 \fB\fBhashstat\fR\fR
1610 .sp .6
1611 .RS 4n
1612 Print a statistics line indicating how effective the internal hash table for
1613 the \fIpath\fR variable has been at locating commands (and avoiding
1614 \fBexec\fRs). An \fBexec\fR is attempted for each component of the \fIpath\fR
1615 where the hash function indicates a possible hit and in each component that
1616 does not begin with a `\fB/\fR'. These statistics only reflect the
1617 effectiveness of the \fIpath\fR variable, not the \fIcdpath\fR variable.
1621 .ne 2
1623 \fB\fBhistory\fR [\fB-hr\fR] [\fIn\fR]\fR
1625 .sp .6
1626 .RS 4n
1627 Display the history list; if \fIn\fR is given, display only the \fIn\fR most
1628 recent events.
1630 .ne 2
1632 \fB\fB-r\fR\fR
1634 .RS 6n
1635 Reverse the order of printout to be most recent first rather than oldest first.
1639 .ne 2
1641 \fB\fB-h\fR\fR
1643 .RS 6n
1644 Display the history list without leading numbers. This is used to produce files
1645 suitable for sourcing using the \fB-h\fR option to \fIsource\fR.
1651 .ne 2
1653 \fB\fBif (\fR\fIexpr\fR \fB)\fR\fIcommand\fR\fR
1655 .sp .6
1656 .RS 4n
1657 If the specified expression evaluates to true, the single \fIcommand\fR with
1658 arguments is executed. Variable substitution on \fIcommand\fR happens early, at
1659 the same time it does for the rest of the \fBif\fR command. \fIcommand\fR must
1660 be a simple command, not a pipeline, a command list, or a parenthesized command
1661 list. \fBNote:\fR I/O redirection occurs even if \fIexpr\fR is false, when
1662 \fIcommand\fR is \fInot\fR executed (this is a bug).
1666 .ne 2
1668 \fB\fBif (\fR\fBexpr\fR\fB) then\fR\fR
1672 \fB\|\|\|.\|.\|.\fR
1676 \fB\fBelse if (\fR\fIexpr2\fR\fB) then\fR\fR
1680 \fB\|\|\|.\|.\|.\fR
1684 \fB\fBelse\fR\fR
1688 \fB\|\|\|.\|.\|.\fR
1692 \fB\fBendif\fR\fR
1694 .sp .6
1695 .RS 4n
1696 If \fIexpr\fR is true, commands up to the first \fBelse\fR are executed.
1697 Otherwise, if \fIexpr2\fR is true, the commands between the \fBelse if\fR and
1698 the second \fBelse\fR are executed. Otherwise, commands between the \fBelse\fR
1699 and the \fBendif\fR are executed. Any number of \fBelse if\fR pairs are
1700 allowed, but only one \fBelse\fR. Only one \fBendif\fR is needed, but it is
1701 required. The words \fBelse\fR and \fBendif\fR must be the first nonwhite
1702 characters on a line. The \fBif\fR must appear alone on its input line or after
1703 an \fBelse\fR.
1707 .ne 2
1709 \fB\fBjobs\fR [\fB-l\fR]\fR
1711 .sp .6
1712 .RS 4n
1713 List the active jobs under job control.
1715 .ne 2
1717 \fB\fB-l\fR\fR
1719 .RS 6n
1720 List process \fBID\fRs, in addition to the normal information.
1726 .ne 2
1728 \fB\fBkill\fR [\fIsig\fR ] [ \fIpid\fR ] [ \fB%\fR\fB\fIjob\fR ] .\|.\|.\fR\fR
1732 \fB\fBkill\fR \fB-l\fR\fR
1734 .sp .6
1735 .RS 4n
1736 Send the \fBTERM\fR (terminate) signal, by default, or the signal specified, to
1737 the specified process ID, the \fIjob\fR indicated, or the current \fIjob\fR.
1738 Signals are either given by number or by name. There is no default. Typing
1739 \fBkill\fR does not send a signal to the current job. If the signal being sent
1740 is \fBTERM\fR (terminate) or \fBHUP\fR (hangup), then the job or process is
1741 sent a \fBCONT\fR (continue) signal as well.
1743 .ne 2
1745 \fB\fB-l\fR\fR
1747 .RS 6n
1748 List the signal names that can be sent.
1754 .ne 2
1756 \fB\fBlimit\fR [\fB-h\fR] [\fIresource\fR [\fImax-use\fR ] ]\fR
1758 .sp .6
1759 .RS 4n
1760 Limit the consumption by the current process or any process it spawns, each not
1761 to exceed \fImax-use\fR on the specified \fIresource\fR. The string
1762 \fBunlimited\fR requests that the current limit, if any, be removed. If
1763 \fImax-use\fR is omitted, print the current limit. If \fIresource\fR is
1764 omitted, display all limits. Run the \fBsysdef\fR(8) command to display
1765 maximum limits for certain resources in your system (although it does not
1766 report stack size). The values reported are in hexadecimal, but can be
1767 translated into decimal numbers using the \fBbc\fR(1) command.
1769 .ne 2
1771 \fB\fB-h\fR\fR
1773 .RS 6n
1774 Use hard limits instead of the current limits. Hard limits impose a ceiling on
1775 the values of the current limits. Only the privileged user can raise the hard
1776 limits.
1779 \fIresource\fR is one of:
1781 .ne 2
1783 \fB\fBcputime\fR\fR
1785 .RS 23n
1786 Maximum \fBCPU\fR seconds per process.
1790 .ne 2
1792 \fB\fBfilesize\fR\fR
1794 .RS 23n
1795 Largest single file allowed. Limited to the size of the filesystem. (See
1796 \fBdf\fR(8)).
1800 .ne 2
1802 \fB\fBdatasize\fR (heapsize)\fR
1804 .RS 23n
1805 Maximum data size (including stack) for the process. This is the size of your
1806 virtual memory See \fBswap\fR(8).
1810 .ne 2
1812 \fB\fBstacksize\fR\fR
1814 .RS 23n
1815 Maximum stack size for the process. The default stack size is 2^64 bytes. You
1816 can use \fBlimit\fR(1) to change this default within a shell.
1820 .ne 2
1822 \fB\fBcoredumpsize\fR\fR
1824 .RS 23n
1825 Maximum size of a core dump (file). This limited to the size of the filesystem.
1829 .ne 2
1831 \fB\fBdescriptors\fR\fR
1833 .RS 23n
1834 Maximum number of file descriptors. Run \fBsysdef()\fR.
1838 .ne 2
1840 \fB\fBmemorysize\fR\fR
1842 .RS 23n
1843 Maximum size of virtual memory.
1846 \fImax-use\fR is a number, with an optional scaling factor, as follows:
1848 .ne 2
1850 \fB\fIn\fR\fBh\fR\fR
1852 .RS 9n
1853 Hours (for \fBcputime\fR).
1857 .ne 2
1859 \fB\fIn\fR\fBk\fR\fR
1861 .RS 9n
1862 \fIn\fR kilobytes. This is the default for all but \fBcputime\fR.
1866 .ne 2
1868 \fB\fIn\fR\fBm\fR\fR
1870 .RS 9n
1871 \fIn\fR megabytes or minutes (for \fBcputime\fR).
1875 .ne 2
1877 \fB\fImm\fR\fB:\fR\fIss\fR\fR
1879 .RS 9n
1880 Minutes and seconds (for \fBcputime\fR).
1883 Example of limit: To limit the size of a core file dump to \fB0\fR Megabytes,
1884 type the following:
1886 .in +2
1888 \fBlimit coredumpsize 0M\fR
1890 .in -2
1896 .ne 2
1898 \fB\fBlogin\fR [\fIusername\fR\|| \fB-p\fR ]\fR
1900 .sp .6
1901 .RS 4n
1902 Terminate a login shell and invoke \fBlogin\fR(1). The \fB\&.logout\fR file is
1903 not processed. If \fIusername\fR is omitted, \fBlogin\fR prompts for the name
1904 of a user.
1906 .ne 2
1908 \fB\fB-p\fR\fR
1910 .RS 6n
1911 Preserve the current environment (variables).
1917 .ne 2
1919 \fB\fBlogout\fR\fR
1921 .sp .6
1922 .RS 4n
1923 Terminate a login shell.
1927 .ne 2
1929 \fB\fBnice\fR [\fB+\fR\fIn\fR \||\fB-\fR\fIn\fR ] [\fIcommand\fR ]\fR
1931 .sp .6
1932 .RS 4n
1933 Increment the process priority value for the shell or for \fIcommand\fR by
1934 \fIn\fR. The higher the priority value, the lower the priority of a process,
1935 and the slower it runs. When given, \fIcommand\fR is always run in a subshell,
1936 and the restrictions placed on commands in simple \fBif\fR commands apply. If
1937 \fIcommand\fR is omitted, \fBnice\fR increments the value for the current
1938 shell. If no increment is specified, \fBnice\fR sets the process priority value
1939 to 4. The range of process priority values is from \(mi20 to 20. Values of
1940 \fIn\fR outside this range set the value to the lower, or to the higher
1941 boundary, respectively.
1943 .ne 2
1945 \fB\fB+\fR\fIn\fR\fR
1947 .RS 6n
1948 Increment the process priority value by \fIn\fR.
1952 .ne 2
1954 \fB\fB-\fR\fIn\fR\fR
1956 .RS 6n
1957 Decrement by \fIn\fR. This argument can be used only by the privileged user.
1963 .ne 2
1965 \fB\fBnohup\fR [\fIcommand\fR ]\fR
1967 .sp .6
1968 .RS 4n
1969 Run \fIcommand\fR with \fBHUP\fRs ignored. With no arguments, ignore \fBHUP\fRs
1970 throughout the remainder of a script. When given, \fIcommand\fR is always run
1971 in a subshell, and the restrictions placed on commands in simple \fBif\fR
1972 statements apply. All processes detached with \fB&\fR are effectively
1973 \fBnohup\fR'd.
1977 .ne 2
1979 \fB\fBnotify\fR [\fB%\fR\fIjob\fR] .\|.\|.\fR
1981 .sp .6
1982 .RS 4n
1983 Notify the user asynchronously when the status of the current job or specified
1984 jobs changes.
1988 .ne 2
1990 \fB\fBonintr\fR [\fB\(mi\fR| \fIlabel\fR]\fR
1992 .sp .6
1993 .RS 4n
1994 Control the action of the shell on interrupts. With no arguments, \fBonintr\fR
1995 restores the default action of the shell on interrupts. (The shell terminates
1996 shell scripts and returns to the terminal command input level). With the
1997 \fB\(mi\fR argument, the shell ignores all interrupts. With a \fIlabel\fR
1998 argument, the shell executes a \fBgoto\fR \fIlabel\fR when an interrupt is
1999 received or a child process terminates because it was interrupted.
2003 .ne 2
2005 \fB\fBpopd\fR [\fB+\fR\fIn\fR ]\fR
2007 .sp .6
2008 .RS 4n
2009 Pop the directory stack and \fBcd\fR to the new top directory. The elements of
2010 the directory stack are numbered from 0 starting at the top.
2012 .ne 2
2014 \fB\fB+\fR\fIn\fR\fR
2016 .RS 6n
2017 Discard the \fIn\fR'th entry in the stack.
2023 .ne 2
2025 \fB\fBpushd\fR [\fB+\fR\fIn\fR |\fIdir\fR]\fR
2027 .sp .6
2028 .RS 4n
2029 Push a directory onto the directory stack. With no arguments, exchange the top
2030 two elements.
2032 .ne 2
2034 \fB\fB+\fR\fIn\fR\fR
2036 .RS 7n
2037 Rotate the \fIn\fR'th entry to the top of the stack and \fBcd\fR to it.
2041 .ne 2
2043 \fB\fIdir\fR\fR
2045 .RS 7n
2046 Push the current working directory onto the stack and change to \fIdir\fR.
2052 .ne 2
2054 \fB\fBrehash\fR\fR
2056 .sp .6
2057 .RS 4n
2058 Recompute the internal hash table of the contents of directories listed in the
2059 \fIpath\fR variable to account for new commands added. Recompute the internal
2060 hash table of the contents of directories listed in the \fIcdpath\fR variable
2061 to account for new directories added.
2065 .ne 2
2067 \fB\fBrepeat\fR \fIcount command\fR\fR
2069 .sp .6
2070 .RS 4n
2071 Repeat \fIcommand count\fR times. \fIcommand\fR is subject to the same
2072 restrictions as with the one-line \fBif\fR statement.
2076 .ne 2
2078 \fB\fBset\fR [\fIvar\fR [\fB=\fR \fIvalue\fR ] ]\fR
2082 \fB\fBset\fR \fIvar\fR\fB[\fR\fIn\fR\fB] =\fR \fIword\fR\fR
2084 .sp .6
2085 .RS 4n
2086 With no arguments, \fBset\fR displays the values of all shell variables.
2087 Multiword values are displayed as a parenthesized list. With the \fIvar\fR
2088 argument alone, \fBset\fR assigns an empty (null) value to the variable
2089 \fIvar\fR. With arguments of the form \fIvar\fR \fB=\fR \fIvalue\fR \fBset\fR
2090 assigns \fIvalue\fR to \fIvar\fR, where \fIvalue\fR is one of:
2092 .ne 2
2094 \fB\fIword\fR\fR
2096 .RS 14n
2097 A single word (or quoted string).
2101 .ne 2
2103 \fB\fB(\fR\fIwordlist\fR\fB)\fR\fR
2105 .RS 14n
2106 A space-separated list of words enclosed in parentheses.
2109 Values are command and filename expanded before being assigned. The form
2110 \fBset\fR\fIvar\fR\fB[\fR\fIn\fR\fB] =\fR \fIword\fR replaces the \fIn\fR'th
2111 word in a multiword value with \fIword\fR.
2115 .ne 2
2117 \fB\fBsetenv\fR [\fIVAR\fR [\fIword\fR ] ]\fR
2119 .sp .6
2120 .RS 4n
2121 With no arguments, \fBsetenv\fR displays all environment variables. With the
2122 \fIVAR\fR argument, \fBsetenv\fR sets the environment variable
2123 \fB\fR\fIVAR\fR\fB \fR to have an empty (null) value. (By convention,
2124 environment variables are normally given upper-case names.) With both \fIVAR\fR
2125 and \fIword\fR arguments, \fBsetenv\fR sets the environment variable \fBNAME\fR
2126 to the value \fIword\fR, which must be either a single word or a quoted string.
2127 The most commonly used environment variables, \fBUSER\fR, \fBTERM\fR, and
2128 \fBPATH\fR, are automatically imported to and exported from the \fBcsh\fR
2129 variables \fBuser\fR, \fBterm\fR, and \fBpath\fR. There is no need to use
2130 \fBsetenv\fR for these. In addition, the shell sets the \fBPWD\fR environment
2131 variable from the \fBcsh\fR variable \fBcwd\fR whenever the latter changes.
2133 The environment variables \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, \fBLC_TIME\fR,
2134 \fBLC_COLLATE\fR, \fBLC_NUMERIC\fR, and \fBLC_MONETARY\fR take immediate effect
2135 when changed within the C shell.
2137 If any of the \fBLC_*\fR variables (\fBLC_CTYPE\fR, \fBLC_MESSAGES\fR,
2138 \fBLC_TIME\fR, \fBLC_COLLATE\fR, \fBLC_NUMERIC\fR, and \fBLC_MONETARY\fR) (see
2139 \fBenviron\fR(5)) are not set in the environment, the operational behavior of
2140 \fBcsh\fR for each corresponding locale category is determined by the value of
2141 the \fBLANG\fR environment variable. If \fBLC_ALL\fR is set, its contents are
2142 used to override both the \fBLANG\fR and the other \fBLC_*\fR variables. If
2143 none of the above variables is set in the environment, the "C" (U.S. style)
2144 locale determines how \fBcsh\fR behaves.
2146 .ne 2
2148 \fB\fBLC_CTYPE\fR\fR
2150 .RS 15n
2151 Determines how \fBcsh\fR handles characters. When \fBLC_CTYPE\fR is set to a
2152 valid value, \fBcsh\fR can display and handle text and filenames containing
2153 valid characters for that locale.
2157 .ne 2
2159 \fB\fBLC_MESSAGES\fR\fR
2161 .RS 15n
2162 Determines how diagnostic and informative messages are presented. This includes
2163 the language and style of the messages and the correct form of affirmative and
2164 negative responses. In the "C" locale, the messages are presented in the
2165 default form found in the program itself (in most cases, U.S./English).
2169 .ne 2
2171 \fB\fBLC_NUMERIC\fR\fR
2173 .RS 15n
2174 Determines the value of the radix character, decimal point, (\fB\&.\fR) in the
2175 "C" locale) and thousand separator, empty string (\fB""\fR) in the "C" locale).
2181 .ne 2
2183 \fB\fBshift\fR [\fIvariable\fR ]\fR
2185 .sp .6
2186 .RS 4n
2187 The components of \fBargv\fR, or \fIvariable\fR, if supplied, are shifted to
2188 the left, discarding the first component. It is an error for the variable not
2189 to be set or to have a null value.
2193 .ne 2
2195 \fB\fBsource\fR [\fB-h\fR] \fIname\fR\fR
2197 .sp .6
2198 .RS 4n
2199 Reads commands from \fIname\fR. \fBsource\fR commands can be nested, but if
2200 they are nested too deeply the shell can run out of file descriptors. An error
2201 in a sourced file at any level terminates all nested \fBsource\fR commands.
2203 .ne 2
2205 \fB\fB-h\fR\fR
2207 .RS 6n
2208 Place commands from the file \fIname\fR on the history list without executing
2209 them.
2215 .ne 2
2217 \fB\fBstop\fR \fB%\fR\fIjobid .\|.\|.\fR\fR
2219 .sp .6
2220 .RS 4n
2221 Stop the current or specified background job.
2225 .ne 2
2227 \fB\fBstop\fR \fIpid .\|.\|.\fR\fR
2229 .sp .6
2230 .RS 4n
2231 Stop the specified process, \fIpid\fR. (see \fBps\fR(1)).
2235 .ne 2
2237 \fB\fBsuspend\fR\fR
2239 .sp .6
2240 .RS 4n
2241 Stop the shell in its tracks, much as if it had been sent a stop signal with
2242 \fB^Z\fR. This is most often used to stop shells started by \fBsu\fR.
2246 .ne 2
2248 \fB\fBswitch (\fR\fIstring\fR\fB)\fR\fR
2252 \fB\fBcase\fR \fIlabel\fR\fB:\fR\fR
2256 \fB\|\|\|.\|.\|.\fR
2260 \fB\fBbreaksw\fR\fR
2264 \fB\|\|\|.\|.\|.\fR
2268 \fB\fBdefault:\fR\fR
2272 \fB\|\|\|.\|.\|.\fR
2276 \fB\fBbreaksw\fR\fR
2280 \fB\fBendsw\fR\fR
2282 .sp .6
2283 .RS 4n
2284 Each \fIlabel\fR is successively matched, against the specified \fIstring\fR,
2285 which is first command and filename expanded. The file metacharacters \fB*\fR,
2286 \fB?\fR and \fB[\fR.\|.\|.\fB]\fR can be used in the case labels, which are
2287 variable expanded. If none of the labels match before a "default" label is
2288 found, execution begins after the default label. Each \fBcase\fR statement and
2289 the \fBdefault\fR statement must appear at the beginning of a line. The command
2290 \fBbreaksw\fR continues execution after the \fBendsw\fR. Otherwise control
2291 falls through subsequent \fBcase\fR and \fBdefault\fR statements as with C. If
2292 no label matches and there is no default, execution continues after the
2293 \fBendsw\fR.
2297 .ne 2
2299 \fB\fBtime\fR [\fIcommand\fR ]\fR
2301 .sp .6
2302 .RS 4n
2303 With no argument, print a summary of time used by this C shell and its
2304 children. With an optional \fIcommand\fR, execute \fIcommand\fR and print a
2305 summary of the time it uses. As of this writing, the \fBtime\fR built-in
2306 command does NOT compute the last 6 fields of output, rendering the output to
2307 erroneously report the value \fB0\fR for these fields.
2309 .in +2
2311 example %\fBtime ls\fR \fB-R\fR
2312         9.0u 11.0s 3:32 10% 0+0k 0+0io 0pf+0w
2314 .in -2
2317 (See the \fBEnvironment Variables and Predefined Shell Variables\fR sub-section
2318 on the \fBtime\fR variable.)
2322 .ne 2
2324 \fB\fBumask\fR [\fIvalue\fR ]\fR
2326 .sp .6
2327 .RS 4n
2328 Display the file creation mask. With \fIvalue\fR, set the file creation mask.
2329 With \fIvalue\fR given in octal, the user can turn off any bits, but cannot
2330 turn on bits to allow new permissions. Common values include 077, restricting
2331 all permissions from everyone else; 002, giving complete access to the group,
2332 and read (and directory search) access to others; or 022, giving read (and
2333 directory search) but not write permission to the group and others.
2337 .ne 2
2339 \fB\fBunalias\fR \fIpattern\fR\fR
2341 .sp .6
2342 .RS 4n
2343 Discard aliases that match (filename substitution) \fIpattern\fR. All aliases
2344 are removed by `\fBunalias *\fR'.
2348 .ne 2
2350 \fB\fBunhash\fR\fR
2352 .sp .6
2353 .RS 4n
2354 Disable the internal hash tables for the \fIpath\fR and \fIcdpath\fR variables.
2358 .ne 2
2360 \fB\fBunlimit\fR [\fB-h\fR] [\fIresource\fR ]\fR
2362 .sp .6
2363 .RS 4n
2364 Remove a limitation on \fIresource\fR. If no \fIresource\fR is specified, then
2365 all resource limitations are removed. See the description of the \fBlimit\fR
2366 command for the list of resource names.
2368 .ne 2
2370 \fB\fB-h\fR\fR
2372 .RS 6n
2373 Remove corresponding hard limits. Only the privileged user can do this.
2379 .ne 2
2381 \fB\fBunset\fR \fIpattern\fR\fR
2383 .sp .6
2384 .RS 4n
2385 Remove variables whose names match (filename substitution) \fIpattern\fR. All
2386 variables are removed by `\fBunset *\fR'; this has noticeably distasteful side
2387 effects.
2391 .ne 2
2393 \fB\fBunsetenv\fR \fIvariable\fR\fR
2395 .sp .6
2396 .RS 4n
2397 Remove \fIvariable\fR from the environment. As with \fBunset\fR, pattern
2398 matching is not performed.
2402 .ne 2
2404 \fB\fBwait\fR\fR
2406 .sp .6
2407 .RS 4n
2408 Wait for background jobs to finish (or for an interrupt) before prompting.
2412 .ne 2
2414 \fB\fBwhile (\fR\fIexpr\fR\fB)\fR\fR
2418 \fB\|\|\|.\|.\|.\fR
2422 \fB\fBend\fR\fR
2424 .sp .6
2425 .RS 4n
2426 While \fIexpr\fR is true (evaluates to nonzero), repeat commands between the
2427 \fBwhile\fR and the matching \fBend\fR statement. \fBbreak\fR and
2428 \fBcontinue\fR can be used to terminate or continue the loop prematurely. The
2429 \fBwhile\fR and \fBend\fR must appear alone on their input lines. If the
2430 shell's input is a terminal, it prompts for commands with a question-mark until
2431 the \fBend\fR command is entered and then performs the commands in the loop.
2435 .ne 2
2437 \fB\fB%\fR [\fIjob\fR ] [\fB&\fR]\fR
2439 .sp .6
2440 .RS 4n
2441 Bring the current or indicated \fIjob\fR to the foreground. With the ampersand,
2442 continue running \fIjob\fR in the background.
2446 .ne 2
2448 \fB\fB@\fR [\fIvar\fR \fB=\fR\fIexpr\fR]\fR
2452 \fB\fB@\fR [\fIvar\fR\fB[\fR\fIn\fR\fB]\fR\fB=\fR\fIexpr\fR]\fR
2454 .sp .6
2455 .RS 4n
2456 With no arguments, display the values for all shell variables. With arguments,
2457 set the variable \fIvar\fR, or the \fIn\fR'th word in the value of \fIvar\fR,
2458 to the value that \fIexpr\fR evaluates to. (If \fB[\fR\fIn\fR\fB]\fR is
2459 supplied, both \fIvar\fR and its \fIn\fR'th component must already exist.)
2461 If the expression contains the characters \fB>\fR, \fB<\fR, \fB&\fR, or
2462 \fB|\fR, then at least this part of \fIexpr\fR must be placed within
2463 parentheses.
2465 The operators \fB*=\fR, \fB+=\fR, and so forth, are available as in C. The
2466 space separating the name from the assignment operator is optional. Spaces are,
2467 however, mandatory in separating components of \fIexpr\fR that would otherwise
2468 be single words.
2470 Special postfix operators, \fB+\|+\fR and \fB\(mi\|\(mi\fR, increment or
2471 decrement \fIname\fR, respectively.
2474 .SS "Environment Variables and Predefined Shell Variables"
2476 Unlike the Bourne shell, the C shell maintains a distinction between
2477 environment variables, which are automatically exported to processes it
2478 invokes, and shell variables, which are not. Both types of variables are
2479 treated similarly under variable substitution. The shell sets the variables
2480 \fBargv\fR, \fBcwd\fR, \fBhome\fR, \fBpath\fR, \fBprompt\fR, \fBshell\fR, and
2481 \fBstatus\fR upon initialization. The shell copies the environment variable
2482 \fBUSER\fR into the shell variable \fBuser\fR, \fBTERM\fR into \fBterm\fR, and
2483 \fBHOME\fR into \fBhome\fR, and copies each back into the respective
2484 environment variable whenever the shell variables are reset. \fBPATH\fR and
2485 \fBpath\fR are similarly handled. You need only set \fBpath\fR once in the
2486 \fB\&.cshrc\fR or \fB\&.login\fR file. The environment variable \fBPWD\fR is
2487 set from \fBcwd\fR whenever the latter changes. The following shell variables
2488 have predefined meanings:
2490 .ne 2
2492 \fB\fBargv\fR\fR
2494 .RS 13n
2495 Argument list. Contains the list of command line arguments supplied to the
2496 current invocation of the shell. This variable determines the value of the
2497 positional parameters \fB$1\fR, \fB$2\fR, and so on.
2501 .ne 2
2503 \fB\fBcdpath\fR\fR
2505 .RS 13n
2506 Contains a list of directories to be searched by the \fBcd\fR, \fBchdir\fR, and
2507 \fBpopd\fR commands, if the directory argument each accepts is not a
2508 subdirectory of the current directory.
2512 .ne 2
2514 \fB\fBcwd\fR\fR
2516 .RS 13n
2517 The full pathname of the current directory.
2521 .ne 2
2523 \fB\fBecho\fR\fR
2525 .RS 13n
2526 Echo commands (after substitutions) just before execution.
2530 .ne 2
2532 \fB\fBfignore\fR\fR
2534 .RS 13n
2535 A list of filename suffixes to ignore when attempting filename completion.
2536 Typically the single word `\fB\&.o\fR'.
2540 .ne 2
2542 \fB\fBfilec\fR\fR
2544 .RS 13n
2545 Enable filename completion, in which case the Control-d character \fBEOT\fR and
2546 the \fBESC\fR character have special significance when typed in at the end of a
2547 terminal input line:
2549 .ne 2
2551 \fB\fBEOT\fR\fR
2553 .RS 7n
2554 Print a list of all filenames that start with the preceding string.
2558 .ne 2
2560 \fB\fBESC\fR\fR
2562 .RS 7n
2563 Replace the preceding string with the longest unambiguous extension.
2569 .ne 2
2571 \fB\fBhardpaths\fR\fR
2573 .RS 13n
2574 If set, pathnames in the directory stack are resolved to contain no
2575 symbolic-link components.
2579 .ne 2
2581 \fB\fBhistchars\fR\fR
2583 .RS 13n
2584 A two-character string. The first character replaces \fB!\fR as the
2585 history-substitution character. The second replaces the carat (\fB^\fR) for
2586 quick substitutions.
2590 .ne 2
2592 \fB\fBhistory\fR\fR
2594 .RS 13n
2595 The number of lines saved in the history list. A very large number can use up
2596 all of the C shell's memory. If not set, the C shell saves only the most recent
2597 command.
2601 .ne 2
2603 \fB\fBhome\fR\fR
2605 .RS 13n
2606 The user's home directory. The filename expansion of ~ refers to the value of
2607 this variable.
2611 .ne 2
2613 \fB\fBignoreeof\fR\fR
2615 .RS 13n
2616 If set, the shell ignores \fBEOF\fR from terminals. This protects against
2617 accidentally killing a C shell by typing a Control-d.
2621 .ne 2
2623 \fB\fBmail\fR\fR
2625 .RS 13n
2626 A list of files where the C shell checks for mail. If the first word of the
2627 value is a number, it specifies a mail checking interval in seconds (default 5
2628 minutes).
2632 .ne 2
2634 \fB\fBnobeep\fR\fR
2636 .RS 13n
2637 Suppress the bell during command completion when asking the C shell to extend
2638 an ambiguous filename.
2642 .ne 2
2644 \fB\fBnoclobber\fR\fR
2646 .RS 13n
2647 Restrict output redirection so that existing files are not destroyed by
2648 accident. \fB>\fR redirections can only be made to new files. \fB>>\fR
2649 redirections can only be made to existing files.
2653 .ne 2
2655 \fB\fBnoglob\fR\fR
2657 .RS 13n
2658 Inhibit filename substitution. This is most useful in shell scripts once
2659 filenames (if any) are obtained and no further expansion is desired.
2663 .ne 2
2665 \fB\fBnonomatch\fR\fR
2667 .RS 13n
2668 Return the filename substitution pattern, rather than an error, if the pattern
2669 is not matched. Malformed patterns still result in errors.
2673 .ne 2
2675 \fB\fBnotify\fR\fR
2677 .RS 13n
2678 If set, the shell notifies you immediately as jobs are completed, rather than
2679 waiting until just before issuing a prompt.
2683 .ne 2
2685 \fB\fBpath\fR\fR
2687 .RS 13n
2688 The list of directories in which to search for commands. \fBpath\fR is
2689 initialized from the environment variable \fBPATH\fR, which the C shell updates
2690 whenever \fBpath\fR changes. A null word ('') specifies the current directory.
2691 The default is typically \fB(/usr/bin .)\fR. One can override this initial
2692 search path upon \fBcsh\fR start-up by setting it in \fB\&.cshrc\fR or
2693 \fB\&.login\fR (for login shells only). If \fBpath\fR becomes unset, only full
2694 pathnames execute. An interactive C shell normally hashes the contents of the
2695 directories listed after reading \fB\&.cshrc\fR, and whenever \fBpath\fR is
2696 reset. If new commands are added, use the \fBrehash\fR command to update the
2697 table.
2701 .ne 2
2703 \fB\fBprompt\fR\fR
2705 .RS 13n
2706 The string an interactive C shell prompts with. Noninteractive shells leave the
2707 \fBprompt\fR variable unset. Aliases and other commands in the \fB\&.cshrc\fR
2708 file that are only useful interactively, can be placed after the following
2709 test: `\fBif ($?prompt == 0) exit\fR', to reduce startup time for
2710 noninteractive shells. A \fB!\fR in the \fBprompt\fR string is replaced by the
2711 current event number. The default prompt is \fIhostname\fR\fB%\fR for mere
2712 mortals, or \fIhostname\fR\fB#\fR for the privileged user.
2714 The setting of \fB$prompt\fR has three meanings:
2716 .ne 2
2718 \fB\fB$prompt\fR not set\fR
2720 .RS 25n
2721 non-interactive shell, test \fB$?prompt\fR.
2725 .ne 2
2727 \fB\fB$prompt\fR set but \fB== ""\fR\fR
2729 .RS 25n
2730 \fB\&.cshrc\fR called by the \fBwhich\fR(1) command.
2734 .ne 2
2736 \fB\fB$prompt\fR set and \fB!= ""\fR\fR
2738 .RS 25n
2739 normal interactive shell.
2745 .ne 2
2747 \fB\fBsavehist\fR\fR
2749 .RS 13n
2750 The number of lines from the history list that are saved in ~/.history when the
2751 user logs out. Large values for \fBsavehist\fR slow down the C shell during
2752 startup.
2756 .ne 2
2758 \fB\fBshell\fR\fR
2760 .RS 13n
2761 The file in which the C shell resides. This is used in forking shells to
2762 interpret files that have execute bits set, but that are not executable by the
2763 system.
2767 .ne 2
2769 \fB\fBstatus\fR\fR
2771 .RS 13n
2772 The status returned by the most recent command. If that command terminated
2773 abnormally, 0200 is added to the status. Built-in commands that fail return
2774 exit status 1; all other built-in commands set status to 0.
2778 .ne 2
2780 \fB\fBtime\fR\fR
2782 .RS 13n
2783 Control automatic timing of commands. Can be supplied with one or two values.
2784 The first is the reporting threshold in \fBCPU\fR seconds. The second is a
2785 string of tags and text indicating which resources to report on. A tag is a
2786 percent sign (\fB%\fR) followed by a single upper-case letter (unrecognized
2787 tags print as text):
2789 .ne 2
2791 \fB\fB%D\fR\fR
2793 .RS 6n
2794 Average amount of unshared data space used in Kilobytes.
2798 .ne 2
2800 \fB\fB%E\fR\fR
2802 .RS 6n
2803 Elapsed (wallclock) time for the command.
2807 .ne 2
2809 \fB\fB%F\fR\fR
2811 .RS 6n
2812 Page faults.
2816 .ne 2
2818 \fB\fB%I\fR\fR
2820 .RS 6n
2821 Number of block input operations.
2825 .ne 2
2827 \fB\fB%K\fR\fR
2829 .RS 6n
2830 Average amount of unshared stack space used in Kilobytes.
2834 .ne 2
2836 \fB\fB%M\fR\fR
2838 .RS 6n
2839 Maximum real memory used during execution of the process.
2843 .ne 2
2845 \fB\fB%O\fR\fR
2847 .RS 6n
2848 Number of block output operations.
2852 .ne 2
2854 \fB\fB%P\fR\fR
2856 .RS 6n
2857 Total CPU time \(em U (user) plus S (system) \(em as a percentage of E
2858 (elapsed) time.
2862 .ne 2
2864 \fB\fB%S\fR\fR
2866 .RS 6n
2867 Number of seconds of CPU time consumed by the kernel on behalf of the user's
2868 process.
2872 .ne 2
2874 \fB\fB%U\fR\fR
2876 .RS 6n
2877 Number of seconds of \fBCPU\fR time devoted to the user's process.
2881 .ne 2
2883 \fB\fB%W\fR\fR
2885 .RS 6n
2886 Number of swaps.
2890 .ne 2
2892 \fB\fB%X\fR\fR
2894 .RS 6n
2895 Average amount of shared memory used in Kilobytes.
2898 The default summary display outputs from the \fB%U\fR, \fB%S\fR, \fB%E\fR,
2899 \fB%P\fR, \fB%X\fR, \fB%D\fR, \fB%I\fR, \fB%O\fR, \fB%F\fR, and \fB%W\fR tags,
2900 in that order.
2904 .ne 2
2906 \fB\fBverbose\fR\fR
2908 .RS 13n
2909 Display each command after history substitution takes place.
2912 .SS "Large File Behavior"
2914 See \fBlargefile\fR(5) for the description of the behavior of \fBcsh\fR when
2915 encountering files greater than or equal to 2 Gbyte (2^31 bytes).
2916 .SH FILES
2917 .ne 2
2919 \fB\fB~/.cshrc\fR\fR
2921 .RS 15n
2922 Read at beginning of execution by each shell.
2926 .ne 2
2928 \fB\fB~/.login\fR\fR
2930 .RS 15n
2931 Read by login shells after \fB\&.cshrc\fR at login.
2935 .ne 2
2937 \fB\fB~/.logout\fR\fR
2939 .RS 15n
2940 Read by login shells at logout.
2944 .ne 2
2946 \fB\fB~/.history\fR\fR
2948 .RS 15n
2949 Saved history for use at next login.
2953 .ne 2
2955 \fB\fB/usr/bin/sh\fR\fR
2957 .RS 15n
2958 The Bourne shell, for shell scripts not starting with a `\fB#\fR'.
2962 .ne 2
2964 \fB\fB/tmp/sh*\fR\fR
2966 .RS 15n
2967 Temporary file for `\fB<<\fR\&'.
2971 .ne 2
2973 \fB\fB/etc/passwd\fR\fR
2975 .RS 15n
2976 Source of home directories for `~\fIname\fR'.
2979 .SH ATTRIBUTES
2981 See \fBattributes\fR(5) for descriptions of the following attributes:
2986 box;
2987 c | c
2988 l | l .
2989 ATTRIBUTE TYPE  ATTRIBUTE VALUE
2991 CSI     Enabled
2994 .SH SEE ALSO
2996 \fBbc\fR(1), \fBecho\fR(1), \fBlimit\fR(1), \fBlogin\fR(1), \fBls\fR(1),
2997 \fBmore\fR(1), \fBpfcsh\fR(1), \fBpfexec\fR(1), \fBps\fR(1), \fBsh\fR(1),
2998 \fBshell_builtins\fR(1), \fBtset\fR(1B), \fBwhich\fR(1), \fBdf\fR(8),
2999 \fBswap\fR(8), \fBsysdef\fR(8), \fBaccess\fR(2), \fBexec\fR(2),
3000 \fBfork\fR(2), \fBpipe\fR(2), \fBa.out\fR(4), \fBascii\fR(5),
3001 \fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5), \fBtermio\fR(7I)
3002 .SH DIAGNOSTICS
3003 .ne 2
3005 \fB\fBYou have stopped jobs.\fR\fR
3007 .RS 26n
3008 You attempted to exit the C shell with stopped jobs under job control. An
3009 immediate second attempt to exit succeeds, terminating the stopped jobs.
3012 .SH WARNINGS
3014 The use of \fBsetuid\fR shell scripts is \fIstrongly\fR discouraged.
3015 .SH NOTES
3017 Words can be no longer than 1024 bytes. The system limits argument lists to
3018 1,048,576 bytes. However, the maximum number of arguments to a command for
3019 which filename expansion applies is 1706. Command substitutions can expand to
3020 no more characters than are allowed in the argument list. To detect looping,
3021 the shell restricts the number of \fBalias\fR substitutions on a single line to
3025 When a command is restarted from a stop, the shell prints the directory it
3026 started in if this is different from the current directory; this can be
3027 misleading (that is, wrong) as the job might have changed directories
3028 internally.
3031 Shell built-in functions are not stoppable/restartable. Command sequences of
3032 the form \fIa\fR \fIb\fR \fIc\fR are also not handled gracefully when stopping
3033 is attempted. If you suspend \fIb\fR, the shell never executes \fIc\fR. This is
3034 especially noticeable if the expansion results from an alias. It can be avoided
3035 by placing the sequence in parentheses to force it into a subshell.
3038 Commands within loops, prompted for by \fB?\fR, are not placed in the
3039 \fIhistory\fR list.
3042 Control structures should be parsed rather than being recognized as built-in
3043 commands. This would allow control commands to be placed anywhere, to be
3044 combined with \fB|\fR, and to be used with \fB&\fR and \fB;\fR metasyntax.
3047 It should be possible to use the \fB:\fR modifiers on the output of command
3048 substitutions. There are two problems with \fB:\fR modifier usage on variable
3049 substitutions: not all of the modifiers are available, and only one modifier
3050 per substitution is allowed.
3053 The \fBg\fR (global) flag in history substitutions applies only to the first
3054 match in each word, rather than all matches in all words. The common text
3055 editors consistently do the latter when given the \fBg\fR flag in a
3056 substitution command.
3059 Quoting conventions are confusing. Overriding the escape character to force
3060 variable substitutions within double quotes is counterintuitive and
3061 inconsistent with the Bourne shell.
3064 Symbolic links can fool the shell. Setting the \fBhardpaths\fR variable
3065 alleviates this.
3068 It is up to the user to manually remove all duplicate pathnames accrued from
3069 using built-in commands as
3071 .in +2
3073 set path = \fIpathnames\fR
3075 .in -2
3082 .in +2
3084 setenv PATH = \fIpathnames\fR
3086 .in -2
3091 more than once. These often occur because a shell script or a \fB\&.cshrc\fR
3092 file does something like
3094 .in +2
3096 `set path=(/usr/local /usr/hosts $path)'
3098 .in -2
3103 to ensure that the named directories are in the pathname list.
3106 The only way to direct the standard output and standard error separately is by
3107 invoking a subshell, as follows:
3109 .in +2
3111 \fIcommand\fR > \fIoutfile\fR ) >& \fIerrorfile\fR
3113 .in -2
3118 Although robust enough for general use, adventures into the esoteric periphery
3119 of the C shell can reveal unexpected quirks.
3122 If you start \fBcsh\fR as a login shell and you do not have a \fB\&.login\fR in
3123 your home directory, then the \fBcsh\fR reads in the \fB/etc/.login\fR.
3126 When the shell executes a shell script that attempts to execute a non-existent
3127 command interpreter, the shell returns an erroneous diagnostic message that the
3128 shell script file does not exist.
3129 .SH BUGS
3131 As of this writing, the \fBtime\fR built-in command does \fBnot\fR compute the
3132 last 6 fields of output, rendering the output to erroneously report the value
3133 \fB0\fR for these fields:
3135 .in +2
3137 example %\fBtime ls -R\fR
3138         9.0u 11.0s 3:32 10% 0+0k 0+0io 0pf+0w
3140 .in -2