diff options
Diffstat (limited to 'bin/csh')
-rw-r--r-- | bin/csh/USD.doc/csh.1 | 80 | ||||
-rw-r--r-- | bin/csh/USD.doc/csh.2 | 210 | ||||
-rw-r--r-- | bin/csh/USD.doc/csh.3 | 35 | ||||
-rw-r--r-- | bin/csh/USD.doc/csh.4 | 6 | ||||
-rw-r--r-- | bin/csh/USD.doc/csh.g | 603 |
5 files changed, 473 insertions, 461 deletions
diff --git a/bin/csh/USD.doc/csh.1 b/bin/csh/USD.doc/csh.1 index 974475543a3..12acb8644be 100644 --- a/bin/csh/USD.doc/csh.1 +++ b/bin/csh/USD.doc/csh.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: csh.1,v 1.8 2004/03/18 09:37:25 jmc Exp $ +.\" $OpenBSD: csh.1,v 1.9 2004/04/21 08:11:15 jmc Exp $ .\" $NetBSD: csh.1,v 1.3 1995/03/21 09:03:33 cgd Exp $ .\" .\" Copyright (c) 1980, 1993 @@ -30,6 +30,10 @@ .\" .\" @(#)csh.1 8.1 (Berkeley) 6/8/93 .\" +.if n \{\ +.po 5n +.ll 70n +.\} .EH 'USD:4-%''An Introduction to the C shell' .OH 'An Introduction to the C shell''USD:4-%' .\".RP @@ -106,7 +110,7 @@ features of the shell and is the definitive reference for questions about the shell. .PP Many words in this document are shown in -.I italics. +.I italics . These are important words; names of commands, and words which have special meaning in discussing the shell and \s-2UNIX\s0. @@ -160,7 +164,7 @@ in the \s-2UNIX\s0 system consist of a list of strings or interpreted as a .I "command name" followed by -.I arguments. +.I arguments . Thus the command .DS mail bill @@ -210,7 +214,7 @@ then echoed the characters `EOT' and transmitted our message. The characters `% ' were printed before and after the mail command by the shell to indicate that input was needed. .PP -After typing the `% ' prompt the shell was reading command input from +After typing the `% ' prompt, the shell was reading command input from our terminal. We typed a complete command `mail bill'. The shell then executed the @@ -386,7 +390,7 @@ Metacharacters normally have effect only when the shell is reading our input. We need not worry about placing shell metacharacters in a letter we are sending via -.I mail, +.I mail , or when we are typing in text or data to some other program. Note that the shell is only reading input when it has prompted with `% ' (although we can type our input even before it prompts). @@ -428,7 +432,7 @@ We should note that if we just typed sort .DE then the sort program would sort lines from its -.I "standard input." +.I "standard input" . Since we did not .I redirect the standard input, it would sort lines as we typed them on the terminal @@ -437,7 +441,7 @@ until we typed a ^D to indicate an end-of-file. A most useful capability is the ability to combine the standard output of one command with the standard input of another, i.e. to run the commands in a sequence known as a -.I pipeline. +.I pipeline . For instance the command .DS ls \-s @@ -449,11 +453,10 @@ may wish to have this sorted by size rather than by name, which is the default way in which .I ls sorts. -We could look at the many options of +We can look at the many options of .I ls -to see if there was an option to do this but would eventually discover -that there is not. -Instead we can use a couple of simple options of the +to see if there was an option to do this, +or instead we can use a couple of simple options of the .I sort command, combining it with .I ls @@ -502,7 +505,7 @@ The notation introduced above is called the .I pipe mechanism. Commands separated by `\||\|' characters are connected together by the -shell and the standard output of each is run into the standard input of the +shell, and the standard output of each is run into the standard input of the next. The leftmost command in a pipeline will normally take its standard input from the terminal and the rightmost will place its standard @@ -691,32 +694,32 @@ the directory of other users. This notation consists of the character `~' (tilde) followed by another user's login name. -For instance the word `~bill' would map to the pathname `/usr/bill' -if the home directory for `bill' was `/usr/bill'. +For instance the word `~bill' would map to the pathname `/home/bill' +if the home directory for `bill' was `/home/bill'. Since, on large systems, users may have login directories scattered over many different disk volumes with different prefix directory names, this notation provides a convenient way of accessing the files of other users. .PP A special case of this notation consists of a `~' alone, e.g. `~/mbox'. -This notation is expanded by the shell into the file `mbox' in your -.I home -directory, i.e. into `/usr/bill/mbox' for me on Ernie Co-vax, the UCB +This notation is expanded by the shell into the file `mbox' in +.I your +home directory, i.e. into `/home/bill/mbox' for me on Ernie Co-vax, the UCB Computer Science Department VAX machine, where this document was prepared. This can be very useful if you have used .I cd to change to another directory and have found a file you wish to copy using -.I cp. +.I cp . If I give the command .DS cp thatfile ~ .DE the shell will expand this command to .DS -cp thatfile /usr/bill +cp thatfile /home/bill .DE -since my home directory is /usr/bill. +since my home directory is /home/bill. .PP There also exists a mechanism using the characters `{' and `}' for abbreviating a set of words which have common parts but cannot @@ -739,7 +742,7 @@ echo * will not echo the character `*'. It will either echo a sorted list of filenames in the current -.I "working directory," +.I "working directory" , or print the message `No match' if there are no files in the working directory. .PP @@ -779,7 +782,7 @@ between `\'' characters. Terminating commands .PP When you are executing a command and the shell is -waiting for it to complete there are several ways +waiting for it to complete, there are several ways to force it to stop. For instance if you type the command .DS @@ -796,11 +799,11 @@ to the command by typing ^C on your terminal.* .FS *On some older Unix systems the \s-2DEL\s0 or \s-2RUBOUT\s0 key -has the same effect. "stty all" will tell you the INTR key value. +has the same effect. "stty all" will tell you the `intr' key value. .FE Since .I cat -does not take any precautions to avoid or otherwise handle this signal +does not take any precautions to avoid or otherwise handle this signal, the \s-2INTERRUPT\s0 will cause it to terminate. @@ -820,7 +823,7 @@ Thus the .I mail program in the first example above was terminated when we typed a ^D which generates an end-of-file from the standard input. -The shell also terminates when it gets an end-of-file printing `logout'; +The shell also terminates when it gets an end-of-file, printing `logout'; \s-2UNIX\s0 then logs you off the system. Since this means that typing too many ^D's can accidentally log us off, the shell has a mechanism for preventing this. @@ -860,9 +863,9 @@ Another possibility for stopping a command is to suspend its execution temporarily, with the possibility of continuing execution later. This is done by sending a \s-2STOP\s0 signal via typing a ^Z. This signal causes all commands running on the terminal -(usually one but more if a pipeline is executing) to become suspended. +(usually one, but more if a pipeline is executing) to become suspended. The shell notices that the command(s) have been suspended, types -`Stopped' and then prompts for a new command. +`Suspended', and then prompts for a new command. The previously executing command has been suspended, but otherwise unaffected by the \s-2STOP\s0 signal. Any other commands can be executed while the original command remains suspended. The suspended command can @@ -879,16 +882,17 @@ example of command suspension follows. % mail harold Someone just copied a big file into my directory and its name is ^Z -Stopped +Suspended % ls funnyfile prog.c prog.o % jobs .ta 1.75i -[1] + Stopped mail harold +[1] + Suspended mail harold % fg mail harold +(continue) funnyfile. Do you know who did it? EOT % @@ -897,7 +901,7 @@ EOT In this example someone was sending a message to Harold and forgot the name of the file he wanted to mention. The mail command was suspended by typing ^Z. When the shell noticed that the mail program was -suspended, it typed `Stopped' and prompted for a new command. Then the +suspended, it typed `Suspended' and prompted for a new command. Then the .I ls command was typed to find out the name of the file. The .I jobs @@ -916,13 +920,13 @@ signals. More information on suspending jobs and controlling them is given in section 2.6. .PP -If you write or run programs which are not fully debugged then it may +If you write or run programs which are not fully debugged, then it may be necessary to stop them somewhat ungracefully. This can be done by sending them a \s-2QUIT\s0 signal, sent by typing a ^\e. This will usually provoke the shell to produce a message like: .DS -Quit (Core dumped) +Quit (core dumped) .DE indicating that a file `core' has been created containing information about the running program's @@ -949,9 +953,9 @@ more /etc/passwd .DE The .I more -program pauses after each complete screen-full and types `\-\-More\-\-' +program pauses after each complete screen-full and types `[filename] %', at which point you can hit a space to get another screen full, a return -to get another line, a `?' to get some help on other commands, or a `q' to end the +to get another line, an `h' to get some help on other commands, or a `q' to end the .I more program. You can also use more as a filter, i.e. .DS @@ -960,7 +964,7 @@ cat /etc/passwd | more works just like the more simple more command above. .PP For stopping output of commands not involving -.I more +.I more , you can use the ^S key to stop the typeout. The typeout will resume when you hit ^Q or any other key, but ^Q is normally used because @@ -989,16 +993,16 @@ shell before you go any further. To try it you can log in to \s-2UNIX\s0 and type the following command to the system: .DS -chsh myname /bin/csh +chsh -s /bin/csh myname .DE Here `myname' should be replaced by the name you typed to the system prompt of `login:' to get onto the system. -Thus I would use `chsh bill /bin/csh'. +Thus I would use `chsh -s /bin/csh bill'. .B You only have to do this once; it takes effect at next login. .R You are now ready to try using -.I csh. +.I csh . .PP Before you do the `chsh' command, the shell you are using when you log into the system is `/bin/sh'. diff --git a/bin/csh/USD.doc/csh.2 b/bin/csh/USD.doc/csh.2 index ceae444557c..3265037765f 100644 --- a/bin/csh/USD.doc/csh.2 +++ b/bin/csh/USD.doc/csh.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: csh.2,v 1.8 2004/03/18 09:37:25 jmc Exp $ +.\" $OpenBSD: csh.2,v 1.9 2004/04/21 08:11:15 jmc Exp $ .\" $NetBSD: csh.2,v 1.3 1995/03/21 09:03:35 cgd Exp $ .\" .\" Copyright (c) 1980, 1993 @@ -47,15 +47,15 @@ We will later see what kinds of commands are usefully placed there. For now we need not have this file and the shell does not complain about its absence. .PP -A +A .I "login shell" , executed after you login to the system, will, after it reads commands from -.I \&.cshrc, +.I \&.cshrc , read commands from a file .I \&.login also in your home directory. -This file contains commands which you wish to do each time you login +This file contains commands which you wish to do each time you log in to the \s-2UNIX\s0 system. My .I \&.login @@ -76,7 +76,7 @@ endif .DE .PP This file contains several commands to be executed by \s-2UNIX\s0 -each time I login. +each time I log in. The first is a .I set command which is interpreted directly by the shell. It sets the shell @@ -95,21 +95,14 @@ An alternative to this is to put the command biff y .DE in place of this -.I set; +.I set ; this will cause me to be notified immediately when mail arrives, and to be shown the first few lines of the new message. .PP -Next I set the shell variable `time' to `15' causing the shell to automatically -print out statistics lines for commands which execute for at least 15 seconds -of \s-2CPU\s+2 time. The variable `history' is set to 10 indicating that -I want the shell to remember the last 10 commands I type in its -.I "history list" , -(described later). -.PP I create an .I alias ``ts'' which executes a -\fItset\fR\|(1) command setting up the modes of the terminal. +tset(1) command setting up the modes of the terminal. The parameters to .I tset indicate the kinds of terminal which I usually use when not on a hardwired @@ -118,6 +111,13 @@ port. I then execute ``ts'' and also use the command to change the interrupt character to ^C and the line kill character to ^U. .PP +Next I set the shell variable `time' to `15' causing the shell to automatically +print out statistics lines for commands which execute for at least 15 seconds +of \s-2CPU\s+2 time. The variable `history' is set to 10 indicating that +I want the shell to remember the last 10 commands I type in its +.I "history list" , +(described later). +.PP I then run the `msgs' program, which provides me with any system messages which I have not seen before; the `\-f' option here prevents it from telling me anything if there are no new messages. @@ -129,7 +129,7 @@ processing my .I \&.login file and begin reading commands from the terminal, prompting for each with `% '. -When I log off (by giving the +When I log off (by giving the .I logout command) the shell will print `logout' and execute commands from the file `.logout' @@ -143,7 +143,7 @@ and will take no further input from my terminal. Shell variables .PP The shell maintains a set of -.I variables. +.I variables . We saw above the variables .I history and @@ -151,7 +151,7 @@ and which had values `10' and `15'. In fact, each shell variable has as value an array of zero or more -.I strings. +.I strings . Shell variables may be assigned values by the set command. It has several forms, the most useful of which was given above and is .DS @@ -166,14 +166,14 @@ By changing the values of these variables one can directly affect the behavior of the shell. .PP One of the most important variables is the variable -.I path. +.I path . This variable contains a sequence of directory names where the shell searches for commands. The .I set command with no arguments shows the value of all variables currently defined (we usually say -.I set) +.I set ) in the shell. The default value for path will be shown by .I set @@ -182,9 +182,9 @@ to be % set .ta .75i argv () -cwd /usr/bill -home /usr/bill -path (. /usr/ucb /bin /usr/bin) +cwd /home/bill +home /home/bill +path (/bin /usr/bin .) prompt % shell /bin/csh status 0 @@ -193,19 +193,20 @@ user bill % .so tabs .DE -This output indicates that the variable path points to the current -directory `.' and then `/usr/ucb', `/bin' and `/usr/bin'. +This output indicates that the variable path points to +`/bin', `/usr/bin', and the current directory `.'. Commands which you may write might be in `.' (usually one of your directories). -Commands developed at Berkeley, live in `/usr/ucb' -while commands developed at Bell Laboratories live in `/bin' and `/usr/bin'. +.\" Commands developed at Berkeley live in `/usr/ucb', +.\" while commands developed at Bell Laboratories live in `/bin' and `/usr/bin'. +Other commands may live in /bin and /usr/bin. .PP A number of locally developed programs on the system live in the directory -`/usr/local'. +`/usr/local/bin'. If we wish that all shells which we invoke to have access to these new programs we can place the command .DS -set path=(. /usr/ucb /bin /usr/bin /usr/local) +set path=(/bin /usr/bin /usr/local/bin .) .DE in our file .I \&.cshrc @@ -217,10 +218,10 @@ set again to see that the value assigned to .I path has changed. -.FS \(dg -Another directory that might interest you is /usr/new, which contains -many useful user-contributed programs provided with Berkeley Unix. -.FE +.\" .FS \(dg +.\" Another directory that might interest you is /usr/new, which contains +.\" many useful user-contributed programs provided with Berkeley Unix. +.\" .FE .PP One thing you should be aware of is that the shell examines each directory which you insert into your path and determines which commands are contained @@ -239,12 +240,12 @@ placing it at the end of the path specification usually works equivalently and reduces overhead. .PP Other useful built in variables are the variable -.I home -which shows your home directory, -.I cwd -which contains your current working directory, -the variable -.I ignoreeof +.I home , +which shows your home directory; +.I cwd , +which contains your current working directory; +and the variable +.I ignoreeof , which can be set in your .I \&.login file to tell the shell not to exit when it receives an end-of-file from @@ -254,7 +255,7 @@ is one of several variables which the shell does not care about the value of, only whether they are .I set or -.I unset. +.I unset . Thus to set this variable you simply do .DS set ignoreeof @@ -269,12 +270,12 @@ Finally, some other built-in shell variables of use are the variables .I noclobber and -.I mail. +.I mail . The metasyntax .DS > filename .DE -which redirects the standard output of a command +which redirects the standard output of a command, will overwrite and destroy the previous contents of the named file. In this way you may accidentally overwrite a file which is valuable. If you would prefer that the shell not overwrite files in this @@ -326,11 +327,11 @@ main() printf("hello); } % cc !$ -cc bug.c -"bug.c", line 4: newline in string or char constant -"bug.c", line 5: syntax error +cc bug.c +bug.c:4: unterminated string or character constant +bug.c:4: possible real start of unterminated constant % ed !$ -ed bug.c +ed bug.c 29 4s/);/"&/p printf("hello"); @@ -338,10 +339,10 @@ w 30 q % !c -cc bug.c +cc bug.c % a.out hello% !e -ed bug.c +ed bug.c 30 4s/lo/lo\e\en/p printf("hello\en"); @@ -351,25 +352,26 @@ q % !c \-o bug cc bug.c \-o bug % size a.out bug -a.out: 2784+364+1028 = 4176b = 0x1050b -bug: 2784+364+1028 = 4176b = 0x1050b +text data bss dec hex +1022 208 288 1518 5ee a.out +1022 208 288 1518 5ee bug % ls \-l !* -ls \-l a.out bug +ls \-l a.out bug \(mirwxr\(mixr\(mix 1 bill 3932 Dec 19 09:41 a.out \(mirwxr\(mixr\(mix 1 bill 3932 Dec 19 09:42 bug % bug hello -% num bug.c | spp -spp: Command not found. -% ^spp^ssp -num bug.c | ssp +% cay -n bug.c +cay: Command not found. +% ^cay^cat +cat -n bug.c 1 main() 3 { 4 printf("hello\en"); 5 } % !! | lpr -num bug.c | ssp | lpr -% +cat -n bug.c | lpr +% .DE .KE In this example we have a very simple C program which has a bug (or two) @@ -401,9 +403,9 @@ we have created were, and then an `ls \-l' command with the same argument list, denoting the argument list `\!*'. Finally we ran the program `bug' to see that its output is indeed correct. .PP -To make a numbered listing of the program we ran the `num' command on the file `bug.c'. -In order to compress out blank lines in the output of `num' we ran the -output through the filter `ssp', but misspelled it as spp. To correct this +To make a numbered listing of the program we ran the `cat' command on the file `bug.c', with the `-n' flag. +Unfortunately, we mispelled `cat' as `cay'. +To correct this we used a shell substitute, placing the old text and new text between `^' characters. This is similar to the substitute command in the editor. Finally, we repeated the same command with `!!', but sent its output to the @@ -467,7 +469,7 @@ dir ~bill .DE then the shell will translate this to .DS -ls \-s /mnt/bill +ls \-s /home/bill .DE .PP Thus the @@ -541,7 +543,7 @@ command |\|& lpr .DE to route both standard and diagnostic output through the pipe to the line printer daemon -.I lpr.\(dd +.I lpr .\(dd .FS \(dd A command of the form .br @@ -611,13 +613,13 @@ would run the .I du program, which reports on the disk usage of your working directory (as well as any directories below it), put the output into the file `usage' and return -immediately with a prompt for the next command without out waiting for +immediately with a prompt for the next command without waiting for .I du to finish. The .I du program would continue executing in the background until it finished, even though you can type and execute more commands in the -mean time. +meantime. When a background job terminates, a message is typed by the shell just before the next prompt telling you that the job has completed. @@ -641,9 +643,9 @@ EOT % .so tabs .DE -If the job did not terminate normally the `Done' message might say +If the job did not terminate normally, the `Done' message might say something else like `Killed'. -If you want the +If you want the terminations of background jobs to be reported at the time they occur (possibly interrupting the output of other foreground jobs), you can set the @@ -655,16 +657,16 @@ Background jobs are unaffected by any signals from the keyboard like the \s-2STOP\s0, \s-2INTERRUPT\s0, or \s-2QUIT\s0 signals mentioned earlier. .PP Jobs are recorded in a table inside the shell until they terminate. -In this table, the shell remembers the command names, arguments and the +In this table, the shell remembers the command names, arguments, and the .I "process numbers" -of all commands in the job as well as the working directory where the job was +of all commands in the job, as well as the working directory where the job was started. Each job in the table is either running .I "in the foreground" with the shell waiting for it to terminate, running -.I "in the background," +.I "in the background" , or -.I suspended. +.I suspended . Only one job can be running in the foreground at one time, but several jobs can be suspended or running in the background at once. As each job is started, it is assigned a small identifying @@ -693,7 +695,7 @@ a new command, leaving the job running simultaneously. .PP As mentioned in section 1.8, foreground jobs become .I suspended -by typing ^Z +by typing ^Z, which sends a \s-2STOP\s0 signal to the currently running foreground job. A background job can become suspended by using the .I stop @@ -705,10 +707,10 @@ For foreground jobs this looks like .DS % du > usage ^Z -Stopped +Suspended % .DE -`Stopped' message is typed by the shell when it notices that the +The `Suspended' message is typed by the shell when it notices that the .I du program stopped. For background jobs, using the @@ -719,7 +721,7 @@ command, it is [1] 2345 % stop %1 .ta 1.75i -[1] + Stopped (signal) sort usage +[1] + Suspended (signal) sort usage % .so tabs .DE @@ -751,7 +753,7 @@ job. All job name arguments begin with the character `%', since some of the job control commands also accept process numbers (printed by the .I ps -command.) +command). The default job (when no argument is given) is called the .I current job and is identified by a `+' in the output of the @@ -764,10 +766,10 @@ If a job is stopped while running in the foreground it becomes the job and the existing current job becomes the .I previous job \- identified by a `\-' in the output of -.I jobs. +.I jobs . When the current job terminates, the previous job becomes the current job. When given, the argument is either `%\-' (indicating -the previous job); `%#', where # is the job number; +the previous job); `%#', where # is the job number; `%pref' where pref is some unique prefix of the command name and arguments of one of the jobs; or `%?' followed by some string found in only one of the jobs. @@ -775,7 +777,7 @@ in only one of the jobs. The .I jobs command types the table of jobs, giving the job number, -commands and status (`Stopped' or `Running') of each background or +commands and status (`Suspended' or `Running') of each background or suspended job. With the `\-l' option the process numbers are also typed. .DS @@ -790,7 +792,7 @@ Stopped .ta 1.75i [1] \(mi Running du > usage [2] Running ls \-s | sort \-n > myfile -[3] \(pl Stopped mail bill +[3] \(pl Suspended mail bill % fg %ls ls \-s | sort \-n > myfile % more myfile @@ -853,24 +855,24 @@ text editor might take a long time. 120000 1,$s/thisword/thatword/ ^Z -Stopped +Suspended % bg [1] ed bigfile & -% +% . . . some foreground commands .ta 1.75i -[1] Stopped (tty input) ed bigfile +[1] Suspended (tty input) ed bigfile % fg ed bigfile w 120000 q -% +% .so tabs .DE So after the `s' command was issued, the `ed' job was stopped with ^Z and then put in the background using -.I bg. +.I bg . Some time later when the `s' command was finished, .I ed tried to read another command and was stopped because jobs @@ -892,7 +894,7 @@ can be used for interactive programs that sometimes have long periods without interaction. Thus each time it outputs a prompt for more input it will stop before the prompt. It can then be run in the foreground using -.I fg, +.I fg , more input can be given and, if necessary stopped and returned to the background. This .I stty @@ -934,13 +936,13 @@ command only prints jobs started in the currently executing shell, it knows nothing about background jobs started in other login sessions or within shell files. The .I ps -can be used in this case to find out about background jobs not started +command can be used in this case to find out about background jobs not started in the current shell. .NH 2 Working Directories .PP As mentioned in section 1.6, the shell is always in a particular -.I "working directory." +.I "working directory" . The `change directory' command .I chdir (its @@ -954,7 +956,7 @@ are located in. It is useful to make a directory for each project you wish to work on and to place all files related to that project in that directory. The `make directory' command, -.I mkdir, +.I mkdir , creates a new directory. The .I pwd @@ -965,16 +967,16 @@ located in. Thus in the example below: .DS % pwd -/usr/bill +/home/bill % mkdir newpaper % chdir newpaper % pwd -/usr/bill/newpaper +/home/bill/newpaper % .DE the user has created and moved to the directory -.I newpaper. +.I newpaper , where, for example, he might place a group of related files. .PP @@ -1006,7 +1008,7 @@ permits you to switch easily between them. .PP The shell always remembers the pathname of its current working directory in the variable -.I cwd. +.I cwd . The shell can also be requested to remember the previous directory when you change to a new working directory. If the `push directory' command .I pushd @@ -1018,7 +1020,7 @@ on a before changing to the new one. You can see this list at any time by typing the `directories' command -.I dirs. +.I dirs . .ID .nf % pushd newpaper/references @@ -1035,7 +1037,7 @@ command .DE The list is printed in a horizontal line, reading left to right, with a tilde (~) as -shorthand for your home directory\(emin this case `/usr/bill'. +shorthand for your home directory\(emin this case `/home/bill'. The directory stack is printed whenever there is more than one entry on it and it changes. It is also printed by a @@ -1082,14 +1084,14 @@ working directory of the currently running foreground job is different from that of the shell. .DS % dirs \-l -/mnt/bill +/home/bill % cd myproject % dirs ~/myproject % ed prog.c 1143 ^Z -Stopped +Suspended % cd .. % ls myproject @@ -1099,8 +1101,8 @@ ed prog.c (wd: ~/myproject) .DE This way the shell warns you when there is an implied change of working directory, even though no cd command was -issued. In the above example the `ed' job was still in `/mnt/bill/project' -even though the shell had changed to `/mnt/bill'. +issued. In the above example the `ed' job was still in `/home/bill/project' +even though the shell had changed to `/home/bill'. A similar warning is given when such a foreground job terminates or is suspended (using the \s-2STOP\s0 signal) since the return to the shell again implies a change of working directory. @@ -1152,7 +1154,7 @@ The numbers given with the history events can be used to reference previous events which are difficult to reference using the contextual mechanisms introduced above. There is also a shell variable called -.I prompt. +.I prompt . By placing a `!' character in its value the shell will there substitute the number of the current command in the history list. You can use this number to refer to this command in a history substitution. @@ -1228,9 +1230,9 @@ exists which will print out the environment. It might then show: .DS % printenv -HOME=/usr/bill +HOME=/home/bill SHELL=/bin/csh -PATH=:/usr/ucb:/bin:/usr/bin:/usr/local +PATH=:/bin:/usr/bin:/usr/local/bin TERM=adm3a USER=bill % @@ -1254,11 +1256,11 @@ command can be used to cause a command to be timed no matter how much \s-2CPU\s0 time it takes. Thus .DS -% time cp /etc/rc /usr/bill/rc +% time cp /etc/rc /home/bill/rc 0.0u 0.1s 0:01 8% 2+1k 3+2io 1pf+0w -% time wc /etc/rc /usr/bill/rc +% time wc /etc/rc /home/bill/rc 52 178 1347 /etc/rc - 52 178 1347 /usr/bill/rc + 52 178 1347 /home/bill/rc 104 356 2694 total 0.1u 0.1s 0:00 13% 3+3k 5+3io 7pf+0w % @@ -1268,7 +1270,7 @@ indicates that the command used a negligible amount of user time (u) and about 1/10th of a system time (s); the elapsed time was 1 second (0:01), there was an average memory usage of 2k bytes of program space and 1k -bytes of data space over the cpu time involved (2+1k); the program +bytes of data space over the CPU time involved (2+1k); the program did three disk reads and two disk writes (3+2io), and took one page fault and was not swapped (1pf+0w). The word count command diff --git a/bin/csh/USD.doc/csh.3 b/bin/csh/USD.doc/csh.3 index 57120822531..dbfc313c9c3 100644 --- a/bin/csh/USD.doc/csh.3 +++ b/bin/csh/USD.doc/csh.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: csh.3,v 1.4 2003/10/30 19:04:47 jmc Exp $ +.\" $OpenBSD: csh.3,v 1.5 2004/04/21 08:11:15 jmc Exp $ .\" $NetBSD: csh.3,v 1.3 1995/03/21 09:03:38 cgd Exp $ .\" .\" Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ Introduction It is possible to place commands in files and to cause shells to be invoked to read and execute commands from these files, which are called -.I "shell scripts." +.I "shell scripts" . We here detail those features of the shell useful to the writers of such scripts. .NH 2 @@ -59,8 +59,8 @@ which contains definitions of the commands used to create these different files when changes occur. Definitions of the means for printing listings, cleaning up the directory in which the files reside, and installing the resultant programs -are easily, and most appropriately placed in this -.I makefile. +are easily, and most appropriately, placed in this +.I makefile . This format is superior and preferable to maintaining a group of shell procedures to maintain these files. .PP @@ -143,7 +143,7 @@ expands to `1' if name is .I set or to `0' if name is not -.I set. +.I set . It is the fundamental mechanism used for checking whether particular variables have been assigned values. All other forms of reference to undefined variables cause errors. @@ -153,7 +153,7 @@ The notation $#name .DE expands to the number of elements in the variable -.I name. +.I name . Thus .DS % set argv=(a b c) @@ -165,7 +165,7 @@ Thus % echo $?argv 0 % echo $argv -Undefined variable: argv. +argv: Undefined variable. % .DE .PP @@ -307,21 +307,22 @@ of the shell and some of its control structure follows: # to the directory ~/backup if they differ from the files # already in ~/backup # +set backdir = ~/backup set noglob -foreach i ($argv) +foreach i ($argv) if ($i !~ *.c) continue # not a .c file so do nothing - if (! \-r ~/backup/$i:t) then - echo $i:t not in backup... not cp\e\'ed + if (! \-r $backdir/$i:t) then + echo $i:t not in backup... not cp\'ed continue endif - cmp \-s $i ~/backup/$i:t # to set $status + cmp -s $i $backdir/$i:t # to set $status if ($status != 0) then echo new backup of $i - cp $i ~/backup/$i:t + cp $i $backdir/$i:t endif end .DE @@ -336,7 +337,7 @@ for each of the values given between `(' and `)' with the named variable, in this case `i' set to successive values in the list. Within this loop we may use the command .I break -to stop executing the loop +to stop executing the loop and .I continue to prematurely terminate one iteration @@ -350,7 +351,7 @@ has the value at the last iteration. We set the variable .I noglob here to prevent filename expansion of the members of -.I argv. +.I argv . This is a good idea, in general, if the arguments to a shell script are filenames which have already been expanded or if the arguments may contain filename expansion metacharacters. @@ -412,7 +413,7 @@ statements above also admit a sequence of pairs followed by a single .I else and an -.I endif, +.I endif , e.g.: .DS \fBif\fR ( expression ) \fBthen\fR @@ -429,7 +430,7 @@ e.g.: Another important mechanism used in shell scripts is the `:' modifier. We can use the modifier `:r' here to extract a root of a filename or `:e' to extract the -.I extension. +.I extension . Thus if the variable .I i has the value @@ -515,7 +516,7 @@ and \fBendsw\fR .DE For details see the manual section for -.I csh. +.I csh . C programmers should note that we use .I breaksw to exit from a diff --git a/bin/csh/USD.doc/csh.4 b/bin/csh/USD.doc/csh.4 index f3806be6f5b..a9cac9c3cc3 100644 --- a/bin/csh/USD.doc/csh.4 +++ b/bin/csh/USD.doc/csh.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: csh.4,v 1.3 2003/06/02 23:32:07 millert Exp $ +.\" $OpenBSD: csh.4,v 1.4 2004/04/21 08:11:15 jmc Exp $ .\" $NetBSD: csh.4,v 1.3 1995/03/21 09:03:39 cgd Exp $ .\" .\" Copyright (c) 1980, 1993 @@ -105,8 +105,8 @@ at embedded blanks and tabs. Braces { ... } in argument expansion .PP Another form of filename expansion, alluded -to before involves the characters `{' and `}'. -These characters specify that the contained strings, separated by `,' +to before, involves the characters `{' and `}'. +These characters specify that the contained strings, separated by `,', are to be consecutively substituted into the containing characters and the results expanded left to right. Thus diff --git a/bin/csh/USD.doc/csh.g b/bin/csh/USD.doc/csh.g index d06ecbf4214..ddcb2ed4588 100644 --- a/bin/csh/USD.doc/csh.g +++ b/bin/csh/USD.doc/csh.g @@ -1,4 +1,4 @@ -.\" $OpenBSD: csh.g,v 1.5 2003/06/02 23:32:07 millert Exp $ +.\" $OpenBSD: csh.g,v 1.6 2004/04/21 08:11:15 jmc Exp $ .\" $NetBSD: csh.g,v 1.3 1995/03/21 09:03:42 cgd Exp $ .\" .\" Copyright (c) 1980, 1993 @@ -38,7 +38,7 @@ introduction to the shell and gives references to sections of the shell document for further information about them. References of the form -`pr (1)' +pr(1) indicate that the command .I pr is in the \s-2UNIX\s0 User Reference manual in section 1. @@ -52,23 +52,22 @@ manual. .IP \&\fB.\fR 15n Your current directory has the name `.' as well as the name printed by the command -.I pwd; +.I pwd ; see also -.I dirs. -The current directory `.' is usually the first -.I component +.I dirs . +The current directory `.' is usually included as a +.I component of the search path contained in the variable -.I path , -thus commands which are in `.' are found first (2.2). -The character `.' is also used in separating -.I components +.I path . +The character `.' is also used in separating +.I components of filenames (1.6). -The character `.' at the beginning of a -.I component -of a -.I pathname -is treated specially and not matched by the +The character `.' at the beginning of a +.I component +of a +.I pathname +is treated specially and not matched by the .I "filename expansion" metacharacters `?', `*', and `[' `]' pairs (1.6). .IP \&\fB..\fR @@ -89,22 +88,22 @@ The current directory is printed by (2.7). .IP a.out Compilers which create executable images create them, by default, in the -file -.I a.out. +file +.I a.out . for historical reasons (2.3). .IP "absolute pathname" .br -A -.I pathname +A +.I pathname which begins with a `/' is .I absolute -since it specifies the -.I path +since it specifies the +.I path of directories from the beginning of the entire directory system \- called the .I root -directory. -.I Pathname s +directory. +.I Pathname s which are not .I absolute are called @@ -120,17 +119,17 @@ command, or a transformation on a command to be performed in the shell. The shell has a command .I alias -which establishes -.I aliases +which establishes +.I aliases and can print their current values. The command .I unalias -is used to remove -.I aliases +is used to remove +.I aliases (2.4). .IP argument -Commands in \s-2UNIX\s0 receive a list of -.I argument +Commands in \s-2UNIX\s0 receive a list of +.I argument words. Thus the command .DS @@ -138,11 +137,11 @@ echo a b c .DE consists of the .I "command name" -`echo' and three -.I argument +`echo' and three +.I argument words `a', `b' and `c'. -The set of -.I arguments +The set of +.I arguments after the .I "command name" is said to be the @@ -162,39 +161,40 @@ commands (2.6). .IP base A filename is sometimes thought of as consisting of a .I base -part, before any `.' character, and an -.I extension +part, before any `.' character, and an +.I extension \- the part after the `.'. See .I filename and .I extension -(1.6) and basename (1). +(1.6) and basename(1). .IP bg The .I bg command causes a -.I suspended +.I suspended job to continue execution in the .I background (2.6). .IP bin A directory containing binaries of programs and shell scripts to be -executed is typically called a -.I bin +executed is typically called a +.I bin directory. -The standard system -.I bin +The standard system +.I bin directories are `/bin' containing the most heavily used commands and `/usr/bin' which contains most other user programs. -Programs developed at UC Berkeley live in `/usr/ucb', while locally -written programs live in `/usr/local'. Games are kept in the directory -`/usr/games'. +.\" Programs developed at UC Berkeley live in `/usr/ucb', while locally +.\" written programs live in `/usr/local'. +Locally written programs live in `/usr/local/bin'. +Games are kept in the directory `/usr/games'. You can place binaries in any directory. If you wish to execute them often, the name of the directories -should be a -.I component +should be a +.I component of the variable .I path . .IP break @@ -214,8 +214,8 @@ A command executed directly by the shell is called a .I builtin command. Most commands in \s-2UNIX\s0 are not built into the shell, -but rather exist as files in -.I bin +but rather exist as files in +.I bin directories. These commands are accessible because the directories in which they reside are named in the @@ -228,23 +228,23 @@ command is used as a label in a .I switch statement in the shell's control structure, similar to that of the language C. -Details are given in the shell documentation `csh (1)' (3.7). +Details are given in the shell documentation csh(1) (3.7). .IP cat The .I cat -program concatenates a list of specified files on the +program concatenates a list of specified files on the .I "standard output" . It is usually used to look at the contents of a single file on the terminal, to `cat a file' (1.8, 2.3). .IP cd The .I cd -command is used to change the +command is used to change the .I "working directory" . With no arguments, .I cd -changes your -.I "working directory" +changes your +.I "working directory" to be your .I home directory (2.4, 2.7). @@ -259,15 +259,15 @@ is usually used because it is easier to type. The .I chsh command is used to change the shell which you use on \s-2UNIX\s0. -By default, you use an different version of the shell +By default, you use a different version of the shell which resides in `/bin/sh'. You can change your shell to `/bin/csh' by doing .DS -chsh your-login-name /bin/csh +chsh -s /bin/csh your-login-name .DE Thus I would do .DS -chsh bill /bin/csh +chsh -s /bin/csh bill .DE It is only necessary to do this once. The next time you log in to \s-2UNIX\s0 after doing this command, @@ -280,10 +280,10 @@ is a program which compares files. It is usually used on binary files, or to see if two files are identical (3.6). For comparing text files the program .I diff , -described in `diff (1)' is used. +described in diff(1) is used. .IP command A function performed by the system, either by the shell -(a builtin +(a builtin .I command ) or by a program residing in a file in a directory within the \s-2UNIX\s0 system, is called a @@ -300,7 +300,7 @@ command names the function to be performed (1.1). .IP "command substitution" .br The replacement of a command enclosed in `\`' characters -by the text output by that command +by the text output by that command is called .I "command substitution" (4.3). @@ -309,7 +309,7 @@ A part of a .I pathname between `/' characters is called a .I component -of that +of that .I pathname . A variable which has multiple strings as value is said to have @@ -344,17 +344,17 @@ character (e.g. `^C' for .IP "core\ dump" When a program terminates abnormally, the system places an image of its current state in a file named `core'. -This +This .I "core dump" -can be examined with the system debugger `adb (1)' -or `sdb (1)' in order to determine what went wrong with the program (1.8). +can be examined with the system debugger gdb(1) +in order to determine what went wrong with the program (1.8). If the shell produces a message of the form .DS -Illegal instruction (core dumped) +Segmentation fault (core dumped) .DE -(where `Illegal instruction' is only one of several possible +(where `Segmentation fault' is only one of several possible messages), you should report this to the author of the program -or a system administrator, +or a system administrator, saving the `core' file. .IP cp The @@ -394,15 +394,15 @@ command prints the current date and time (1.3). .I Debugging is the process of correcting mistakes in programs and shell scripts. The shell has several options and variables which may be used -to aid in shell -.I debugging +to aid in shell +.I debugging (4.4). .IP default: The label .I default: is used within shell .I switch -statements, as it is in the C language +statements, as it is in the C language, to label the code to be executed if none of the .I case labels matches the value switched on (3.7). @@ -412,40 +412,40 @@ The or \s-2RUBOUT\s0 key on the terminal normally causes an interrupt to be sent to the current job. -Many users change the interrupt character to be ^C. +Most users map the interrupt character to ^C. .IP detached -A command that continues running in the -.I background -after you logout is said to be +A command that continues running in the +.I background +after you log out is said to be .I detached . .IP diagnostic An error message produced by a program is often referred to as a .I diagnostic . -Most error messages are not written to the +Most error messages are not written to the .I "standard output" , since that is often directed away from the terminal (1.3, 1.5). Error messages are instead written to the .I "diagnostic output" which may be directed away from the terminal, but usually is not. -Thus -.I diagnostics +Thus +.I diagnostics will usually appear on the terminal (2.5). .IP directory A structure which contains files. -At any time you are in one particular -.I directory -whose names can be printed by the command +At any time you are in one particular +.I directory +whose name can be printed by the command .I pwd . The .I chdir -command will change you to another -.I directory , +command will change you to another +.I directory , and make the files -in that -.I directory -visible. The -.I directory -in which you are when you first login is your +in that +.I directory +visible. The +.I directory +in which you are when you first log in is your .I home directory (1.1, 2.7). .IP "directory\ stack" @@ -468,12 +468,12 @@ as the first directory name on the left (2.7). The .I dirs command prints the shell's -.I "directory stack" +.I "directory stack" (2.7). .IP du The .I du -command is a program (described in `du (1)') which +command is a program (described in du(1)) which prints the number of disk blocks is all directories below and including your current .I "working directory" @@ -509,13 +509,13 @@ and whenever a command reads to the end of a file which it has been given as input. Commands receiving input from a .I pipe -receive an -.I "end\f1-\fPof\f1-\fPfile" +receive an +.I "end\f1-\fPof\f1-\fPfile" when the command sending them input completes. -Most commands terminate when they receive an +Most commands terminate when they receive an .I "end\f1-\fPof\f1-\fPfile" . -The shell has an option to ignore -.I "end\f1-\fPof\f1-\fPfile" +The shell has an option to ignore +.I "end\f1-\fPof\f1-\fPfile" from a terminal input which may help you keep from logging out accidentally by typing too many control-d's (1.1, 1.8, 3.8). @@ -537,15 +537,15 @@ In this example, \e .I escape s `*' (1.7). There is also a non-printing character called -.I escape , +.I escape , usually labelled \s-2ESC\s0 or \s-2ALTMODE\s0 on terminal keyboards. Some older \s-2UNIX\s0 systems use this character to indicate that -output is to be -.I suspended . +output is to be +.I suspended . Most systems use control-s to stop the output and control-q to start it. .IP /etc/passwd This file contains information about the accounts currently on the @@ -561,7 +561,7 @@ The commands and .I grep are often used to search for information in this file. -See `finger (1)', `passwd(5)', and `grep (1)' for more details. +See finger(1), passwd(5), and grep(1) for more details. .IP exit The .I exit @@ -577,7 +577,7 @@ a status of zero being considered The .I exit command can be used to force a shell command script to give a non-zero -.I "exit status" +.I "exit status" (3.6). .IP expansion The replacement of strings in the shell input which contain metacharacters @@ -587,17 +587,17 @@ Thus the replacement of the word `*' by a sorted list of files in the current directory is a `filename expansion'. Similarly the replacement of the characters `!!' by the text of the last command is a `history expansion'. -.I Expansions +.I Expansions are also referred to as .I substitutions (1.6, 3.4, 4.2). .IP expressions -.I Expressions +.I Expressions are used in the shell to control the conditional structures used in the writing of shell scripts and in calculating values for these scripts. -The operators available in shell -.I expressions +The operators available in shell +.I expressions are those of the language C (3.5). .IP extension @@ -606,8 +606,8 @@ Filenames often consist of a name and an .I extension separated by the character `.'. -By convention, groups of related files often share the same -.I root +By convention, groups of related files often share the same +.I root name. Thus if `prog.c' were a C program, then the object file for this program would be stored in `prog.o'. @@ -634,28 +634,28 @@ job in the Each file in \s-2UNIX\s0 has a name consisting of up to 14 characters and not including the character `/' which is used in .I pathname -building. Most +building. Most .I filenames -do not begin with the character `.', and contain +do not begin with the character `.', and contain only letters and digits with perhaps a `.' separating the .I base -portion of the -.I filename -from an -.I extension +portion of the +.I filename +from an +.I extension (1.6). .IP "filename expansion" .br -.I "Filename expansion" +.I "Filename expansion" uses the metacharacters `*', `?' and `[' and `]' to provide a convenient mechanism for naming files. -Using -.I "filename expansion" +Using +.I "filename expansion" it is easy to name all the files in -the current directory, or all files which have a common -.I root -name. Other -.I "filename expansion" +the current directory, or all files which have a common +.I root +name. Other +.I "filename expansion" mechanisms use the metacharacter `~' and allow files in other users' directories to be named easily (1.6, 4.2). .IP flag @@ -685,7 +685,7 @@ shell is waiting for them to finish before prompting for another command they are said to be .I "foreground jobs" or -.I "running in the foreground" \&. +.I "running in the foreground" \&. This is as opposed to .I background . .I Foreground @@ -709,14 +709,14 @@ will print each line in the file which contains the string `bill'. Actually, .I grep -scans for +scans for .I "regular expressions" in the sense of the editors -`ed (1)' and `ex (1)'. +ed(1) and ex(1). .I Grep stands for -`globally find -.I "regular expression" +`globally find +.I "regular expression" and print' (2.4). .IP head The @@ -740,8 +740,8 @@ is the part after the last `/'. The `:h' and `:t' modifiers allow the .I head or .I tail -of a -.I pathname +of a +.I pathname stored in a shell variable to be used (3.6). .IP history The @@ -756,12 +756,12 @@ where these commands are kept, and a variable which controls how large this list is (2.3). .IP "home\ directory" .br -Each user has a +Each user has a .I "home directory" , which is given in your entry in the password file, .I /etc/passwd . -This is the directory which you are placed in when you first login. +This is the directory which you are placed in when you first log in. The .I cd or @@ -769,11 +769,11 @@ or command with no arguments takes you back to this directory, whose name is recorded in the shell variable .I home . -You can also access the -.I "home directories" +You can also access the +.I "home directories" of other users in forming -filenames using a -.I "filename expansion" +filenames using a +.I "filename expansion" notation and the character `~' (1.6). .IP if A conditional command within the shell, the @@ -793,7 +793,7 @@ variable if you wish in your .I \&.login file and then use the command .I logout -to logout. +to log out. This is useful if you sometimes accidentally type too many control-d characters, logging yourself off (2.2). @@ -802,26 +802,26 @@ Many commands on \s-2UNIX\s0 take information from the terminal or from files which they then act on. This information is called .I input . -Commands normally read for -.I input +Commands normally read +.I input from their .I "standard input" which is, by default, the terminal. -This -.I "standard input" +This +.I "standard input" can be redirected from a file using a shell metanotation with the character `<'. -Many commands will also read from a file specified as argument. -Commands placed in +Many commands will also read from a file specified as an argument. +Commands placed in .I pipelines will read from the output of the previous -command in the +command in the .I pipeline . -The leftmost command in a -.I pipeline +The leftmost command in a +.I pipeline reads from the terminal if -you neither redirect its -.I input +you neither redirect its +.I input nor give it a filename to use as .I "standard input" . Special mechanisms exist for supplying input to commands in shell @@ -833,18 +833,18 @@ is a signal to a program that is generated by typing ^C. (On older versions of UNIX the \s-2RUBOUT\s0 or \s-2DELETE\s0 key were used for this purpose.) It causes most programs to stop execution. Certain programs, such as the shell and the editors, -handle an -.I interrupt +handle an +.I interrupt in special ways, usually by stopping what they are doing and prompting for another command. While the shell is executing another command and waiting for it -to finish, the shell does not listen to -.I interrupts. -The shell often wakes up when you hit -.I interrupt +to finish, the shell does not listen to +.I interrupts . +The shell often wakes up when you hit +.I interrupt because many commands -die when they receive an -.I interrupt +die when they receive an +.I interrupt (1.8, 3.9). .IP job One or more commands @@ -852,8 +852,8 @@ typed on the same input line separated by `|' or `;' characters are run together and are called a .I job \&. Simple commands run by themselves without any `|' or `;' characters -are the simplest -.I jobs. +are the simplest +.I jobs . .I Jobs are classified as .I foreground , @@ -866,7 +866,11 @@ The builtin functions that control the execution of jobs are called .I "job control" commands. These are -.I "bg, fg, stop, kill" +.I bg , +.I fg , +.I stop , +and +.I kill (2.6). .IP "job\ number" When each job @@ -897,14 +901,14 @@ The file .I \&.login in your .I home -directory is read by the shell each time you login to \s-2UNIX\s0 +directory is read by the shell each time you log in to \s-2UNIX\s0 and the commands there are executed. There are a number of commands which are usefully placed here, especially .I set commands to the shell itself (2.1). .IP "login\ shell" -The shell that is started on your terminal when you login is called +The shell that is started on your terminal when you log in is called your .I "login shell" . It is different from other shells which you may run (e.g. on @@ -913,18 +917,18 @@ in that it reads the .I \&.login file before reading commands from the terminal and it reads the .I \&.logout -file after you logout +file after you log out (2.1). .IP logout The .I logout command causes a login shell to exit. Normally, a login shell will exit when you hit control-d -generating an -.I end\f1-\fPof\f1-\fPfile, +generating an +.I end\f1-\fPof\f1-\fPfile , but if you have set .I ignoreeof -in you +in your .I \&.login file then this will not work and you must use .I logout @@ -972,7 +976,7 @@ users (1.1, 2.1), whether they are logged on or not. The .I make command is used to maintain one or more related files and to -organize functions to be performed on these files. +organize functions to be performed on these files. In many ways .I make is easier to use, and more helpful than @@ -981,23 +985,24 @@ shell command scripts (3.2). The file containing commands for .I make is called -.I makefile -or +.I makefile +or .I Makefile (3.2). .IP manual -The -.I manual +The +.I manual often referred to is the `\s-2UNIX\s0 manual'. -It contains 8 numbered sections with a description of each \s-2UNIX\s0 +It contains 9 numbered sections with a description of each \s-2UNIX\s0 program (section 1), system call (section 2), subroutine (section 3), device (section 4), special data structure (section 5), game (section 6), -miscellaneous item (section 7) and system administration program (section 8). +miscellaneous item (section 7), system administration program (section 8), +and kernel internals (section 9). There are also supplementary documents (tutorials and reference guides) for individual programs which require explanation in more detail. -An online version of the -.I manual +An online version of the +.I manual is accessible through the .I man command. @@ -1005,8 +1010,7 @@ Its documentation can be obtained online via .DS man man .DE -If you can't decide what manual page to look in, try the -.I apropos (1) +If you can't decide what manual page to look in, try the apropos(1) command. The supplementary documents are in subdirectories of /usr/doc. .IP metacharacter @@ -1018,17 +1022,17 @@ These characters are called If it is necessary to place these characters in arguments to commands without them having their special meaning then they must be .I quoted . -An example of a -.I metacharacter -is the character `>' which is used +An example of a +.I metacharacter +is the character `>', which is used to indicate placement of output into a file. For the purposes of the .I history mechanism, -most unquoted +most unquoted .I metacharacters form separate words (1.4). -The appendix to this user's manual lists the +The appendix to this user's manual lists the .I metacharacters in groups by their function. .IP mkdir @@ -1036,13 +1040,13 @@ The .I mkdir command is used to create a new directory. .IP modifier -Substitutions with the -.I history +Substitutions with the +.I history mechanism, keyed by the character `!' or of variables using the metacharacter `$', are often subjected to modifications, indicated by placing the character `:' after the -substitution and following this with the -.I modifier +substitution and following this with the +.I modifier itself. The .I "command substitution" @@ -1081,55 +1085,55 @@ The .I notify variable, if set, causes the shell to always report the termination of -.I background +.I background jobs exactly when they occur (2.6). .IP onintr The .I onintr command is built into the shell and is used to control the action -of a shell command script when an -.I interrupt +of a shell command script when an +.I interrupt signal is received (3.9). .IP output Many commands in \s-2UNIX\s0 result in some lines of text which are called their -.I output. -This -.I output +.I output . +This +.I output is usually placed on what is known as the -.I "standard output" +.I "standard output" , which is normally connected to the user's terminal. The shell has a syntax using the metacharacter `>' for redirecting -the -.I "standard output" +the +.I "standard output" of a command to a file (1.3). Using the .I pipe mechanism and the metacharacter `|' it is also possible for -the -.I "standard output" -of one command to become the -.I "standard input" +the +.I "standard output" +of one command to become the +.I "standard input" of another command (1.5). Certain commands such as the line printer daemon -.I p -do not place their results on the -.I "standard output" +.I lpd +do not place their results on the +.I "standard output" but rather in more useful places such as on the line printer (2.3). Similarly the .I write command places its output on another user's terminal rather than its -.I "standard output" +.I "standard output" (2.3). Commands also have a .I "diagnostic output" where they write their error messages. -Normally these go to the terminal even if the -.I "standard output" +Normally these go to the terminal even if the +.I "standard output" has been sent to a file or another command, but it is possible -to direct error diagnostics along with -.I "standard output" +to direct error diagnostics along with +.I "standard output" using a special metanotation (2.5). .IP path The shell has a variable @@ -1147,10 +1151,11 @@ Since the normal definition of the .I path variable is .DS -path (. /usr/ucb /bin /usr/bin) +path (/bin /usr/bin .) .DE -the shell normally looks in the current directory, and then in -the standard system directories `/usr/ucb', `/bin' and `/usr/bin' for the named +the shell normally looks in the standard system directories +`/bin' and `/usr/bin', +and then the current directory, for the named command (2.2). If the command cannot be found the shell will print an error diagnostic. Scripts of shell commands will be executed using another shell to interpret @@ -1160,43 +1165,43 @@ This is normally true because a command of the form chmod 755 script .DE was executed to turn this execute permission on (3.3). -If you add new commands to a directory in the -.I path , +If you add new commands to a directory in the +.I path , you should issue -the command -.I rehash +the command +.I rehash (2.2). .IP pathname A list of names, separated by `/' characters, forms a -.I pathname. +.I pathname . Each -.I component, +.I component , between successive `/' characters, names a directory -in which the next -.I component +in which the next +.I component file resides. -.I Pathnames +.I Pathnames which begin with the character `/' are interpreted relative to the .I root directory in the filesystem. -Other -.I pathnames +Other +.I pathnames are interpreted relative to the current directory as reported by -.I pwd. -The last component of a -.I pathname +.I pwd . +The last component of a +.I pathname may name a directory, but usually names a file. .IP pipeline -A group of commands which are connected together, the +A group of commands which are connected together, the .I "standard output" -of each connected to the -.I "standard input" +of each connected to the +.I "standard input" of the next, is called a -.I pipeline. +.I pipeline . The .I pipe mechanism used to connect these commands is indicated by @@ -1234,18 +1239,18 @@ command is used to print the current setting of variables in the environment (2.8). .IP process -An instance of a running program is called a -.I process +An instance of a running program is called a +.I process (2.6). -\s-2UNIX\s0 assigns each -.I process -a unique number when it is +\s-2UNIX\s0 assigns each +.I process +a unique number when it is started \- called the .I "process number" . -.I "Process numbers" -can be used to stop individual +.I "Process numbers" +can be used to stop individual .I processes -using the +using the .I kill or .I stop @@ -1259,21 +1264,21 @@ Usually synonymous with .I command ; a binary file or shell command script which performs a useful function is often -called a +called a .I program . .IP prompt -Many programs will print a -.I prompt +Many programs will print a +.I prompt on the terminal when they expect input. Thus the editor -`ex (1)' will print a `:' when it expects input. -The shell +ex(1) will print a `:' when it expects input. +The shell .I prompts for input with `% ' and occasionally with `? ' when reading commands from the terminal (1.1). The shell has a variable .I prompt -which may be set to a different value to change the shell's main +which may be set to a different value to change the shell's main .I prompt . This is mostly used when debugging the shell (2.8). .IP pushd @@ -1298,16 +1303,16 @@ stopped, awaiting some event (sleeping), and whether it is swapped out), and the amount of \s-2CPU\s0 time it has used so far. The command is identified by printing some of the words used when it was invoked (2.6). -Shells, such as the -.I csh -you use to run the -.I ps -command, are not normally shown in the output. +.\" Shells, such as the +.\" .I csh +.\" you use to run the +.\" .I ps +.\" command, are not normally shown in the output. .IP pwd The .I pwd -command prints the full -.I pathname +command prints the full +.I pathname of the current .I "working directory" \&. The @@ -1321,7 +1326,7 @@ is used to terminate programs which are behaving unreasonably. It normally produces a core image file (1.8). .IP quotation The process by which metacharacters are prevented their special -meaning, usually by using the character `\' in pairs, or by +meaning, usually by using the character `\'' in pairs, or by using the character `\e', is referred to as .I quotation (1.7). @@ -1346,7 +1351,7 @@ which does not begin with a `/' is called a .I "relative pathname" since it is interpreted .I relative -to the current +to the current .I "working directory" . The first .I component @@ -1377,18 +1382,18 @@ directories. The name used in .I pathnames to indicate the .I root -is `/'. -.I Pathnames +is `/'. +.I Pathnames starting with `/' are said to be .I absolute since they start at the .I root directory. .I Root -is also used as the part of a -.I pathname +is also used as the part of a +.I pathname that is left after removing -the +the .I extension . See .I filename @@ -1399,15 +1404,15 @@ key is often used to erase the previously typed character; some users prefer the \s-2BACKSPACE\s0 for this purpose. On older versions of \s-2UNIX\s0 this key served as the \s-2INTR\s0 character. .IP "scratch file" -Files whose names begin with a `#' are referred to as +Files whose names begin with a `#' are referred to as .I "scratch files" , since they are automatically removed by the system after a couple of days of non-use, or more frequently if disk space becomes tight (1.3). .IP script -Sequences of shell commands placed in a file are called shell command +Sequences of shell commands placed in a file are called shell command .I scripts . -It is often possible to perform simple tasks using these -.I scripts +It is often possible to perform simple tasks using these +.I scripts without writing a program in a language such as C, by using the shell to selectively run other programs (3.3, 3.10). .IP set @@ -1416,11 +1421,11 @@ The builtin command is used to assign new values to shell variables and to show the values of the current variables. Many shell variables have special meaning to the shell itself. -Thus by using the -.I set +Thus by using the +.I set command the behavior of the shell can be affected (2.1). .IP setenv -Variables in the environment `environ (5)' +Variables in the environment environ(5) can be changed by using the .I setenv builtin command (2.8). @@ -1428,19 +1433,19 @@ The .I printenv command can be used to print the value of the variables in the environment. .IP shell -A -.I shell +A +.I shell is a command language interpreter. -It is possible to write and run your own +It is possible to write and run your own .I shell , -as -.I shells +as +.I shells are no different than any other programs as far as the system is concerned. -This manual deals with the details of one particular +This manual deals with the details of one particular .I shell , called -.I csh. +.I csh . .IP "shell script" See .I script @@ -1462,8 +1467,8 @@ commands (1.8, 2.6). The .I sort program sorts a sequence of lines in ways that can be controlled -by argument -.I flags +by argument +.I flags (1.5). .IP source The @@ -1496,22 +1501,22 @@ when it finishes. By convention a .I status of zero indicates that the command succeeded. -Commands may return non-zero -.I status +Commands may return non-zero +.I status to indicate that some abnormal event has occurred. The shell variable .I status -is set to the -.I status +is set to the +.I status returned by the last command. It is most useful in shell command scripts (3.6). .IP stop The .I stop command causes a -.I background -job to become -.I suspended +.I background +job to become +.I suspended (2.6). .IP string A sequential group of characters taken together is called a @@ -1522,19 +1527,19 @@ can contain any printable characters (2.2). The .I stty program changes certain parameters inside \s-2UNIX\s0 which determine -how your terminal is handled. See `stty (1)' for a complete description (2.6). +how your terminal is handled. See stty(1) for a complete description (2.6). .IP substitution The shell implements a number of .I substitutions where sequences indicated by metacharacters are replaced by other sequences. -Notable examples of this are history -.I substitution +Notable examples of this are history +.I substitution keyed by the -metacharacter `!' and variable -.I substitution +metacharacter `!' and variable +.I substitution indicated by `$'. -We also refer to -.I substitutions +We also refer to +.I substitutions as .I expansions (3.4). @@ -1569,10 +1574,10 @@ statement in the language C (3.7). When a command which is being executed finishes we say it undergoes .I termination or -.I terminates. -Commands normally terminate when they read an +.I terminates . +Commands normally terminate when they read an .I end\f1-\fPof\f1-\fPfile -from their +from their .I "standard input" . It is also possible to terminate commands by sending them an @@ -1593,7 +1598,7 @@ The .I time command can be used to measure the amount of \s-2CPU\s0 and real time consumed by a specified command as well -as the amount of disk i/o, memory utilized, and number +as the amount of disk I/O, memory utilized, and number of page faults and swaps taken by the command (2.1, 2.8). .IP tset The @@ -1640,12 +1645,12 @@ and .I expansion (2.2, 3.4). .IP variables -.I Variables +.I Variables in .I csh hold one or more strings as value. -The most common use of -.I variables +The most common use of +.I variables is in controlling the behavior of the shell. See @@ -1654,7 +1659,7 @@ See and .I ignoreeof for examples. -.I Variables +.I Variables such as .I argv are also used in writing shell programs (shell command scripts) @@ -1668,7 +1673,7 @@ This is often useful in debugging shell scripts. The .I verbose variable is set by the shell's -.I \-v +.B \-v command line option (3.10). .IP wc The @@ -1684,37 +1689,37 @@ A sequence of characters which forms an argument to a command is called a .I word . Many characters which are neither letters, digits, `\-', `.' nor `/' -form -.I words +form +.I words all by themselves even if they are not surrounded by blanks. -Any sequence of characters may be made into a -.I word +Any sequence of characters may be made into a +.I word by surrounding it with `\'' characters except for the characters `\'' and `!' which require special treatment (1.1). -This process of placing special characters in -.I words +This process of placing special characters in +.I words without their special meaning is called .I quoting . .IP "working directory" .br At any given time you are in one particular directory, called -your +your .I "working directory" . This directory's name is printed by the .I pwd command and the files listed by .I ls are the ones in this directory. -You can change -.I "working directories" +You can change +.I "working directories" using .I chdir . .IP write The .I write command is an obsolete way of communicating with other users who are logged in to -\s-2UNIX\s0 (you have to take turns typing). If you are both using display -terminals, use \fItalk\fP(1), which is much more pleasant. +\s-2UNIX\s0 (you have to take turns typing). If you are both using display +terminals, use talk(1), which is much more pleasant. |