W. Joy - An Introduction to the C shell (794270), страница 13
Текст из файла (страница 13)
The printenv command can be used to print the value of the variables inthe environment.shellA shell is a command language interpreter. It is possible to write and run your ownshell , as shells are no different than any other programs as far as the system is concerned. This manual deals with the details of one particular shell , called csh.shell scriptSee script (3.3, 3.10).signalA signal in UNIX is a short message that is sent to a running program which causessomething to happen to that process. Signals are sent either by typing special controlcharacters on the keyboard or by using the kill or stop commands (1.8, 2.6).sortThe sort program sorts a sequence of lines in ways that can be controlled by argumentflags (1.5).sourceThe source command causes the shell to read commands from a specified file.
It is mostuseful for reading files such as .cshrc after changing them (2.8).special characterSee metacharacters and the appendix to this manual.standardWe refer often to the standard input and standard output of commands. See input andoutput (1.3, 3.8).statusA command normally returns a status when it finishes.
By convention a status of zeroindicates that the command succeeded. Commands may return non-zero status to indicate that some abnormal event has occurred. The shell variable status is set to the statusreturned by the last command. It is most useful in shell commmand scripts (3.6).stopThe stop command causes a background job to become suspended (2.6).stringA sequential group of characters taken together is called a string . Strings can containany printable characters (2.2).sttyThe stty program changes certain parameters inside UNIX which determine how your terminal is handled. See ‘stty (1)’ for a complete description (2.6).substitutionThe shell implements a number of substitutions where sequences indicated by metacharacters are replaced by other sequences. Notable examples of this are history substitutionkeyed by the metacharacter ‘!’ and variable substitution indicated by ‘$’.
We also referto substitutions as expansions (3.4).suspendedA job becomes suspended after a STOP signal is sent to it, either by typing a control -z atthe terminal (for foreground jobs) or by using the stop command (for background jobs).When suspended , a job temporarily stops running until it is restarted by either the fg orbg command (2.6).switchThe switch command of the shell allows the shell to select one of a number of sequencesof commands based on an argument string.
It is similar to the switch statement in thelanguage C (3.7).terminationWhen a command which is being executed finishes we say it undergoes termination orterminates. Commands normally terminate when they read an end-of-file from their----USD:4-44An Introduction to the C shellstandard input . It is also possible to terminate commands by sending them an interruptor quit signal (1.8). The kill program terminates specified jobs (2.6).thenThe then command is part of the shell’s ‘if-then-else-endif ’ control construct used incommand scripts (3.6).timeThe time command can be used to measure the amount of CPU and real time consumedby a specified command as well as the amount of disk i/o, memory utilized, and numberof page faults and swaps taken by the command (2.1, 2.8).tsetThe tset program is used to set standard erase and kill characters and to tell the systemwhat kind of terminal you are using.
It is often invoked in a .login file (2.1).ttyThe word tty is a historical abbreviation for ‘teletype’ which is frequently used in UNIXto indicate the port to which a given terminal is connected. The tty command will printthe name of the tty or port to which your terminal is presently connected.unaliasThe unalias command removes aliases (2.8).UNIXis an operating system on which csh runs. UNIX provides facilities which allowcsh to invoke other programs such as editors and text formatters which you may wish touse.unsetThe unset command removes the definitions of shell variables (2.2, 2.8).UNIXvariable expansionSee variables and expansion (2.2, 3.4).variablesVariables in csh hold one or more strings as value.
The most common use of variablesis in controlling the behavior of the shell. See path , noclobber , and ignoreeof for examples. Variables such as argv are also used in writing shell programs (shell commandscripts) (2.2).verboseThe verbose shell variable can be set to cause commands to be echoed after they are history expanded.
This is often useful in debugging shell scripts. The verbose variable isset by the shell’s −v command line option (3.10).wcThe wc program calculates the number of characters, words, and lines in the files whosenames are given as arguments (2.6).whileThe while builtin control construct is used in shell command scripts (3.7).wordA sequence of characters which forms an argument to a command is called a word .Many characters which are neither letters, digits, ‘−’, ‘.’ nor ‘/’ form words all by themselves even if they are not surrounded by blanks. Any sequence of characters may bemade into a word by surrounding it with ‘´’ characters except for the characters ‘´’ and‘!’ which require special treatment (1.1).
This process of placing special characters inwords without their special meaning is called quoting .working directoryAt any given time you are in one particular directory, called your working directory .This directory’s name is printed by the pwd command and the files listed by ls are theones in this directory. You can change working directories using chdir .writeThe write command is an obsolete way of communicating with other users who arelogged in to UNIX (you have to take turns typing).
If you are both using display terminals, use talk(1), which is much more pleasant..