UNIX Reference Manual (794271), страница 7
Текст из файла (страница 7)
Each word in the variable path names a directory from which the shell will attemptto execute the command. If it is given neither a −c nor a −t option, the shell will hash the names in thesedirectories into an internal table so that it will only try an exec in a directory if there is a possibility that thecommand resides there. This shortcut greatly speeds command location when many directories are presentin the search path. If this mechanism has been turned off (via unhash), or if the shell was given a −c or−t argument, and in any case for each directory component of path that does not begin with a ‘/’, the shellconcatenates with the given command name to form a path name of a file which it then attempts to execute.Parenthesized commands are always executed in a subshell.
Thus(cd; pwd); pwdprints the home directory; leaving you where you were (printing this after the home directory), whilecd; pwdleaves you in the home directory. Parenthesized commands are most often used to prevent chdir from affecting the current shell.If the file has execute permissions but is not an executable binary to the system, then it is assumed to be a filecontaining shell commands and a new shell is spawned to read it.If there is an alias for shell then the words of the alias will be prepended to the argument list to form theshell command. The first word of the alias should be the full path name of the shell (e.g., ‘$shell’).
Notethat this is a special, late occurring, case of alias substitution, and only allows words to be prepended tothe argument list without change.Signal handlingThe shell normally ignores quit signals. Jobs running detached (either by & or the bg or %... & commands) are immune to signals generated from the keyboard, including hangups. Other signals have the values which the shell inherited from its parent. The shell’s handling of interrupts and terminate signals in shell4th Berkeley DistributionJanuary 21, 199419CSH ( 1 )UNIX Reference ManualCSH ( 1 )scripts can be controlled by onintr.
Login shells catch the terminate signal; otherwise this signal ispassed on to children from the state in the shell’s parent. Interrupts are not allowed when a login shell isreading the file .logout.AUTHORWilliam Joy. Job control and directory stack features first implemented by J.E. Kulp of IIASA, Laxenburg,Austria, with different syntax than that used now. File name completion code written by Ken Greer, HPLabs. Eight-bit implementation Christos S. Zoulas, Cornell University.FILES˜/.cshrc˜/.login˜/.logout/bin/sh/tmp/sh∗/etc/passwdRead at beginning of execution by each shell.Read by login shell, after ‘.cshrc’ at login.Read by login shell, at logout.Standard shell, for shell scripts not starting with a ‘#’.Temporary file for ‘<<’.Source of home directories for ‘˜name’.LIMITATIONSWord lengths − Words can be no longer than 1024 characters. The system limits argument lists to 10240characters.
The number of arguments to a command that involves filename expansion is limited to 1/6’th thenumber of characters allowed in an argument list. Command substitutions may substitute no more charactersthan are allowed in an argument list. To detect looping, the shell restricts the number of alias substitutionson a single line to 20.SEE ALSOsh(1), access(2), execve(2), fork(2), killpg(2), pipe(2), sigvec(2), umask(2),setrlimit(2), wait(2), tty(4), a.out(5), environ(7),introduction to the C shellHISTORYCsh appeared in 3BSD. It was a first implementation of a command language interpreter incorporating a history mechanism (see History Substitutions), job control facilities (see Jobs), interactive file name and username completion (see File Name Completion), and a C-like syntax.
There are now many shells that alsohave these mechanisms, plus a few more (and maybe some bugs too), which are available through the usenet.BUGSWhen a command is restarted from a stop, the shell prints the directory it started in if this is different fromthe current directory; this can be misleading (i.e., wrong) as the job may have changed directories internally.Shell builtin functions are not stoppable/restartable. Command sequences of the form ‘a ; b ; c’ are also nothandled gracefully when stopping is attempted.
If you suspend ‘b’, the shell will immediately execute ‘c’.This is especially noticeable if this expansion results from an alias. It suffices to place the sequence ofcommands in ()’s to force it to a subshell, i.e., ‘( a ; b ; c )’.Control over tty output after processes are started is primitive; perhaps this will inspire someone to work on agood virtual terminal interface. In a virtual terminal interface much more interesting things could be donewith output control.Alias substitution is most often used to clumsily simulate shell procedures; shell procedures should be provided instead of aliases.Commands within loops, prompted for by ‘?’, are not placed on the history list. Control structure shouldbe parsed instead of being recognized as built-in commands. This would allow control commands to beplaced anywhere, to be combined with ‘|’, and to be used with ‘&’ and ‘;’ metasyntax.4th Berkeley DistributionJanuary 21, 199420CSH ( 1 )UNIX Reference ManualCSH ( 1 )It should be possible to use the ‘:’ modifiers on the output of command substitutions.The way the filec facility is implemented is ugly and expensive.4th Berkeley DistributionJanuary 21, 199421.