⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 csh.1

📁 早期freebsd实现
💻 1
📖 第 1 页 / 共 5 页
字号:
.\" Copyright (c) 1980, 1990, 1993.\"	The Regents of the University of California.  All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\"    notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\"    notice, this list of conditions and the following disclaimer in the.\"    documentation and/or other materials provided with the distribution..\" 3. All advertising materials mentioning features or use of this software.\"    must display the following acknowledgement:.\"	This product includes software developed by the University of.\"	California, Berkeley and its contributors..\" 4. Neither the name of the University nor the names of its contributors.\"    may be used to endorse or promote products derived from this software.\"    without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\"     @(#)csh.1	8.2 (Berkeley) 1/21/94.\".Dd January 21, 1994.Dt CSH 1.Os BSD 4.Sh NAME.Nm csh.Nd a shell (command interpreter) with C-like syntax.Sh SYNOPSIS.Nm csh.Op Fl bcefinstvVxX.Op arg ....Nm csh.Op Fl l.Sh DESCRIPTIONThe.Nm cshis a command language interpreterincorporating a history mechanism (see.Nm History Substitutions ) ,job control facilities (see.Nm Jobs ) ,interactive file nameand user name completion (see.Nm File Name Completion ) ,and a C-like syntax. It is used both as an interactivelogin shell and a shell script command processor..Ss Argument list processingIf the first argument (argument 0) to the shell is.Ql Fl \& ,then this is a login shell.A login shell also can be specified by invoking the shell with the .Ql Fl lflag as the only argument..PpThe rest of the flag arguments are interpreted as follows:.Bl -tag -width 5n.It Fl bThis flag forces a ``break'' from option processing, causing any furthershell arguments to be treated as non-option arguments.The remaining arguments will not be interpreted as shell options.This may be used to pass options to a shell script without confusionor possible subterfuge.The shell will not run a set-user ID script without this option..It Fl cCommands are read from the (single) following argument which mustbe present.Any remaining arguments are placed in.Ar argv ..It Fl eThe shell exits if any invoked command terminates abnormallyor yields a non-zero exit status..It Fl fThe shell will start faster, because it will neither search for norexecute commands from the file.Pa \&.cshrcin the invoker's home directory..It Fl iThe shell is interactive and prompts for its top-level input,even if it appears not to be a terminal.Shells are interactive without this option if their inputsand outputs are terminals..It Fl lThe shell is a login shell (only applicable if.Fl lis the only flag specified)..It Fl nCommands are parsed, but not executed.This aids in syntactic checking of shell scripts..It Fl sCommand input is taken from the standard input..It Fl tA single line of input is read and executed.A.Ql \emay be used to escape the newline at the end of thisline and continue onto another line..It Fl vCauses the.Ar verbosevariable to be set, with the effectthat command input is echoed after history substitution..It Fl xCauses the.Ar echovariable to be set, so that commands are echoed immediately before execution..It Fl VCauses the.Ar verbosevariable to be set even before.Pa .cshrcis executed..It Fl XIs to.Fl xas.Fl Vis to.Fl v ..El.PpAfter processing of flag arguments, if arguments remain but none of the.Fl c ,.Fl i ,.Fl s ,or.Fl toptions were given, the first argument is taken as the name of a file ofcommands to be executed.The shell opens this file, and saves its name for possible resubstitutionby `$0'.Since many systems use either the standard version 6 or version 7 shellswhose shell scripts are not compatible with this shell, the shell willexecute such a `standard' shell if the first character of a scriptis not a `#', i.e., if the script does not start with a comment.Remaining arguments initialize the variable.Ar argv ..PpAn instance of.Nm cshbegins by executing commands from the file.Pa /etc/csh.cshrcand,if this is a login shell,.Pa \&/etc/csh.login .It then executescommands from.Pa \&.cshrcin the.Ar homedirectory of the invoker, and, if this is a login shell, the file.Pa \&.loginin the same location.It is typical for users on crt's to put the command ``stty crt''in their.Pa \&.loginfile, and to also invoke.Xr tset  1there..PpIn the normal case, the shell will begin reading commands from theterminal, prompting with `% '.Processing of arguments and the use of the shell to process filescontaining command scripts will be described later..PpThe shell repeatedly performs the following actions:a line of command input is read and broken into.Ar words  .This sequence of words is placed on the command history list and parsed.Finally each command in the current line is executed..PpWhen a login shell terminates it executes commands from the files.Pa .logoutin the user's.Ar homedirectory and.Pa /etc/csh.logout ..Ss Lexical structureThe shell splits input lines into words at blanks and tabs with thefollowing exceptions.The characters`&' `\&|' `;' `<' `>' `(' `)'form separate words.If doubled in `&&', `\&|\&|', `<<' or `>>' these pairs form single words.These parser metacharacters may be made part of other words, or prevented theirspecial meaning, by preceding them with `\e'.A newline preceded by a `\e' is equivalent to a blank..PpStrings enclosed in matched pairs of quotations,`'\|', `\*(ga' or `"',form parts of a word; metacharacters in these strings, including blanksand tabs, do not form separate words.These quotations have semantics to be described later.Within pairs of `\'' or `"' characters, a newline preceded by a `\e' givesa true newline character..PpWhen the shell's input is not a terminal,the character `#' introduces a comment that continues to the end of theinput line.It is prevented this special meaning when preceded by `\e'and in quotations using `\`', `\'', and `"'..Ss CommandsA simple command is a sequence of words, the first of whichspecifies the command to be executed.A simple command ora sequence of simple commands separated by `\&|' charactersforms a pipeline.The output of each command in a pipeline is connected to the input of the next.Sequences of pipelines may be separated by `;', and are then executedsequentially.A sequence of pipelines may be executed without immediatelywaiting for it to terminate by following it with an `&'..PpAny of the above may be placed in `(' `)' to form a simple command (thatmay be a component of a pipeline, etc.).It is also possible to separate pipelines with `\&|\&|' or `&&' showing,as in the C language,that the second is to be executed only if the first fails or succeedsrespectively. (See.Em Expressions . ).Ss JobsThe shell associates a.Ar jobwith each pipeline.  It keepsa table of current jobs, printed by the.Ar jobscommand, and assigns them small integer numbers.  Whena job is started asynchronously with `&', the shell prints a line that lookslike:.Bd -filled -offset indent.Op 11234.Ed.Ppshowing that the job which was started asynchronously was job number1 and had one (top-level) process, whose process id was 1234..PpIf you are running a job and wish to do something else you may hit the key.Nm ^Z(control-Z) which sends a STOP signal to the current job.The shell will then normally show that the job has been `Stopped',and print another prompt.  You can then manipulate the state of this job,putting it in the.Em backgroundwith the.Ar bgcommand, or run some othercommands and eventually bring the job back into the foreground withthe.Em foregroundcommand.Ar fg  .A.Nm ^Ztakes effect immediately andis like an interrupt in that pending output and unread input are discardedwhen it is typed.  There is another special key.Nm ^Ythat does not generate a STOP signal until a program attempts to.Xr read  2it.This request can usefully be typed ahead when you have prepared some commandsfor a job that you wish to stop after it has read them..PpA job being run in the background will stop if it tries to readfrom the terminal.  Background jobs are normally allowed to produce output,but this can be disabled by giving the command ``stty tostop''.If you set thistty option, then background jobs will stop when they try to produceoutput like they do when they try to read input..PpThere are several ways to refer to jobs in the shell.  The character`%' introduces a job name.  If you wish to refer to job number 1, you canname it as `%1'.  Just naming a job brings it to the foreground; thus`%1' is a synonym for `fg %1', bringing job number 1 back into the foreground.Similarly saying `%1 &' resumes job number 1 in the background.Jobs can also be named by prefixes of the string typed in to start them,if these prefixes are unambiguous, thus `%ex' would normally restarta suspended.Xr ex  1job, if there were only one suspended job whose name began withthe string `ex'.  It is also possible to say `%?string'which specifies a job whose text contains.Ar string ,if there is only one such job..PpThe shell maintains a notion of the current and previous jobs.In output about jobs, the current job is marked with a `+'and the previous job with a `\-'.  The abbreviation `%+' refersto the current job and `%\-' refers to the previous job.  For closeanalogy with the syntax of the.Ar historymechanism (described below),`%%' is also a synonym for the current job..PpThe job control mechanism requires that the.Xr stty 1option.Ic newbe set. It is an artifact from a.Em newimplementationof thetty driver that allows generation of interrupt characters fromthe keyboard to tell jobs to stop.  See stty(1) for detailson setting options in the new tty driver..Ss Status reportingThis shell learns immediately whenever a process changes state.It normally informs you whenever a job becomes blocked so thatno further progress is possible, but only just before it printsa prompt.  This is done so that it does not otherwise disturb your work.If, however, you set the shell variable.Ar notify ,the shell will notify you immediately of changes of status in backgroundjobs.There is also a shell command.Ar notifythat marks a single process so that its status changes will be immediatelyreported.  By default.Ar notifymarks the current process;simply say `notify' after starting a background job to mark it..PpWhen you try to leave the shell while jobs are stopped, you willbe warned that `You have stopped jobs.'  You may use the.Ar jobscommand to see what they are.  If you do this or immediately try toexit again, the shell will not warn you a second time, and the suspendedjobs will be terminated..Ss File Name CompletionWhen the file name completion feature is enabled by settingthe shell variable.Ar filec(see.Ic set ) ,.Nm cshwillinteractively complete file names and user names from uniqueprefixes, when they are input from the terminal followed bythe escape character (the escape key, or control-[)For example,if the current directory looks like.Bd -literal -offset indentDSC.OLD  bin      cmd      lib      xmpl.cDSC.NEW  chaosnet cmtest   mail     xmpl.obench    class    dev      mbox     xmpl.out.Ed.Ppand the input is.Pp.Dl % vi ch<escape>.Pp.Nm cshwill complete the prefix ``ch''to the only matching file name ``chaosnet'', changing the inputline to.Pp.Dl % vi chaosnet.PpHowever, given.Pp.Dl % vi D<escape>.Pp.Nm cshwill only expand the input to.Pp.Dl % vi DSC..Ppand will sound the terminal bell to indicate that the expansion isincomplete, since there are two file names matching the prefix ``D''..PpIf a partial file name is followed by the end-of-file character(usually control-D), then, instead of completing the name,.Nm cshwill list all file names matching the prefix.  For example,the input.Pp.Dl % vi D<control-D>.Ppcauses all files beginning with ``D'' to be listed:.Pp.Dl DSC.NEW	DSC.OLD.Ppwhile the input line remains unchanged..PpThe same system of escape and end-of-file can also be used toexpand partial user names, if the word to be completed(or listed) begins with the character ``~''.  For example,typing.Pp.Dl cd ~ro<escape>.Ppmay produce the expansion.Pp.Dl cd ~root.PpThe use of the terminal bell to signal errors or multiple matchescan be inhibited by setting the variable.Ar nobeep  ..PpNormally, all files in the particular directory are candidatesfor name completion.  Files with certain suffixes can be excludedfrom consideration by setting the variable.Ar fignoreto thelist of suffixes to be ignored.  Thus, if.Ar fignoreis set bythe command.Pp

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -