Lines Matching +full:one +full:- +full:to +full:- +full:many
1 .\"-
14 .\" may be used to endorse or promote products derived from this software
18 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 .EH 'USD:4-%''An Introduction to the C shell'
30 .OH 'An Introduction to the C shell''USD:4-%'
33 An Introduction to the C shell
52 mechanism similar to the
54 of \s-2INTERLISP\s0.
55 While incorporating many features of other shells which make
57 most of the features unique to
59 are designed more for the interactive \s-2UNIX\s0 user.
61 \s-2UNIX\s0
62 users who have read a general introduction to the system
68 explore after you have begun to become acquainted with the shell.
83 is the name of one particular command interpreter on
84 \s-2UNIX\s0.
87 is to translate command lines typed at a terminal into
94 in interacting with the \s-2UNIX\s0 system.
96 In addition to this document, you will want to refer to a copy
97 of the \s-2UNIX\s0 User Reference Manual.
104 Many words in this document are shown in
108 the shell and \s-2UNIX\s0.
109 Many of the words are defined in a glossary at the end of this document.
119 I would especially like to thank Michael Ubell
124 shell, helping to unify those concepts which are present and to identify
129 added their documentation to this introduction.
140 \s-2UNIX\s0
148 external to the shell.
154 in the \s-2UNIX\s0 system consist of a list of strings or
167 names the command to be executed, in this case the
168 mail program which sends messages to other users.
169 The shell uses the name of the command in attempting to execute it for you.
174 which is expected to contain the mail program.
183 program to be the name of a user to whom mail is to be sent.
190 My document seems to be missing page 5.
197 Here we typed a message to send to
199 and ended this message with a ^D which sent an end-of-file to
202 is to be read ``control-\fIx\fR'' and represents the striking of the \fIx\fR
207 by the shell to indicate that input was needed.
216 and went dormant waiting for it to complete.
218 an end-of-file via typing a ^D after which the shell noticed
220 and signaled us that it was ready to read from the terminal again by
223 This is the essential pattern of all interaction with \s-2UNIX\s0
228 you to finish editing and obediently prompt you again whenever you finish
237 characters on your terminal \- the erase character erases the last
240 By default, the erase character is the delete key (equivalent to `^?')
241 and the kill character is `^U'. Some people prefer to make the erase character
242 the backspace key (equivalent to `^H').
245 tset \-e
249 to set the erase character to tset's default setting for this character
254 A useful notion in \s-2UNIX\s0 is that of a
257 While many arguments to commands specify file names or user names,
259 which you wish to invoke.
260 By convention, such arguments begin with the character `\-' (hyphen).
268 .I \-s
271 ls \-s
277 The manual section for each command in the \s-2UNIX\s0 reference manual
282 Most other commands have either no options or only one or two options.
283 It is hard to remember options of commands which are not used very
284 frequently, so most \s-2UNIX\s0 utilities perform only one or two functions
285 rather than having a large number of hard to remember options.
287 Output to files
290 can also be executed with this input and/or output done to
293 Thus suppose we wish to save the current date in a file called `now'.
310 `>' and the name of the file where output is to be placed.
320 It is important to know that the
322 command was unaware that its output was going to a file rather than
328 One other thing to note here is that the file `now'
337 exists to prevent this from happening accidentally;
341 Thus the default is for files to be permanent. If you wish to create a file
346 *Note that if your erase character is a `#', you will have to precede the
347 `#' with a `\e'. The fact that the `#' character is the old (pre-\s-2CRT\s0)
349 allows this convention to be used for scratch files. If you are using a
350 \s-2CRT\s0, your erase character should be a ^H, as we demonstrated
357 command above, we don't really want to save the output forever, so we
372 meaning to the shell.
374 have special meaning to the shell.
377 which allows us to use
386 or when we are typing in text or data to some other program.
392 We learned above how to
398 It is also possible to redirect the
420 for input itself since this is less to type.
431 until we typed a ^D to indicate an end-of-file.
433 A most useful capability is the ability to combine the standard output
434 of one command with the standard input of another, i.e. to run the
439 ls \-s
444 may wish to have this sorted by size rather than by name, which is
448 We could look at the many options of
450 to see if there was an option to do this but would eventually discover
459 .I \-n
463 ls \-s | sort \-n
468 .I \-s
469 is to be
477 .I \-r
482 ls \-s | sort \-n \-r | head \-5
486 We have run this to the standard input of the
488 command asking it to sort numerically in reverse order (largest first).
509 routing of information to the line printer.
513 Many commands to be executed will need the names of files as arguments.
514 \s-2UNIX\s0
522 of directories to follow to reach the file.
536 that begins with a slash is said to be an
549 Such pathnames are said to be
552 in the working directory and descending to lower levels of directories
564 It is inconvenient to have most non-alphabetic characters in filenames
565 because many of these have special meaning to the shell.
566 The character `.' (period) is not a shell-metacharacter and is often used
589 If we wished to refer to all four of these files in a command, we could
594 This expression is expanded by the shell, before the command to which it is
617 of the one input word.
627 will echo a line of filenames; first those with one character names,
643 We can also place two characters around a `\-' in this notation to denote
647 chap.[1\-5]
660 An important point to note is that if a list of argument words to
664 fails to match any existing file names, then the shell considers this
675 in the working directory which have special meaning to the system,
684 Another filename expansion mechanism gives access to the pathname of
690 For instance the word `~bill' would map to the pathname `/usr/bill'
693 many different disk volumes with different prefix directory names,
700 directory, i.e. into `/usr/bill/mbox' for me on Ernie Co-vax, the UCB
704 to change to another directory and have found a file you wish to
711 the shell will expand this command to
743 digits, `/', `.' or `\-' in an argument word to a command is to enclose
748 There is one special character `!' which is used by the
763 These two mechanisms suffice to place any printing character into a word
764 which is an argument to a shell command. They can be combined, as in
778 waiting for it to complete there are several ways
779 to force it to stop.
786 This is likely to continue for several minutes unless you stop it.
788 \s-2INTERRUPT\s0
794 *On some older Unix systems the \s-2DEL\s0 or \s-2RUBOUT\s0 key
799 does not take any precautions to avoid or otherwise handle this signal
801 \s-2INTERRUPT\s0
802 will cause it to terminate.
806 If you hit \s-2INTERRUPT\s0 again, the shell will just
807 repeat its prompt since it handles \s-2INTERRUPT\s0 signals
808 and chooses to continue to execute commands rather than terminating
813 Another way in which many programs terminate is when they get an end-of-file
818 which generates an end-of-file from the standard input.
819 The shell also terminates when it gets an end-of-file printing `logout';
820 \s-2UNIX\s0 then logs you off the system.
821 Since this means that typing too many ^D's can accidentally log us off,
834 This is because it read to the end-of-file of our file
842 command would then have written the text through the pipe to the
850 command would have received an end-of-file from it and terminated.
853 These commands could also have been stopped by sending an \s-2INTERRUPT\s0.
855 Another possibility for stopping a command is to suspend its execution
857 done by sending a \s-2STOP\s0 signal via typing a ^Z.
859 (usually one but more if a pipeline is executing) to become suspended.
863 unaffected by the \s-2STOP\s0 signal. Any other commands can be executed
872 during editing, when you need to look at another file before continuing.
894 In this example someone was sending a message to Harold and forgot the
895 name of the file he wanted to mention. The mail command was suspended
899 command was typed to find out the name of the file. The
901 command was run to find out which command was suspended.
904 command was typed to continue execution of the mail program. Input
912 from the keyboard. This also happens on \s-2INTERRUPT\s0, and \s-2QUIT\s0
918 be necessary to stop them somewhat ungracefully.
919 This can be done by sending them a \s-2QUIT\s0
921 This will usually provoke the shell to produce a message like:
927 state when it terminated due to the \s-2QUIT\s0 signal.
928 You can examine this file yourself, or forward information to the
934 commands will ignore \s-2INTERRUPT\s0 and \s-2QUIT\s0 signals at the
935 terminal. To stop them you must use the
939 If you want to examine the output of a command without having it move
950 program pauses after each complete screenful and types `\-\-More\-\-'
951 at which point you can hit a space to get another screenful, a return
952 to get another line, a `?' to get some help on other commands, or a `q' to end the
963 ^S key to stop the typeout. The typeout will resume when you
965 it only restarts the output and does not become input to the program
966 which is running. This works well on low-speed terminals, but at 9600
967 baud it is hard to type ^S and ^Q fast enough to paginate
972 An additional possibility is to use the ^O flush output
975 or until the next shell prompt. This can be used to allow a command
976 to complete without having to suffer through the output on a slow
985 shell, but you will surely want to try using the
987 To try it you can log in to \s-2UNIX\s0 and type the following
988 command to the system:
992 Here `myname' should be replaced by the name you typed to
993 the system prompt of `login:' to get onto the system.
996 You only have to do this once; it takes effect at next login.
998 You are now ready to try using
1003 In fact, much of the above discussion is applicable to `/bin/sh'.
1004 The next section will introduce many features particular to
1006 so you should change your shell to