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

📄 csh.1

📁 早期freebsd实现
💻 1
📖 第 1 页 / 共 3 页
字号:
.\" Copyright (c) 1980, 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.1 (Berkeley) 6/8/93.\".EH 'USD:4-%''An Introduction to the C shell'.OH 'An Introduction to the C shell''USD:4-%'.\".RP.TLAn Introduction to the C shell.AUWilliam Joy(revised for 4.3BSD by Mark Seiden).AIComputer Science Division.brDepartment of Electrical Engineering and Computer Science.brUniversity of California, Berkeley.brBerkeley, California 94720.AB.I Cshis a new command language interpreter for.UXsystems.It incorporates good features of other shells and a.I historymechanism similar to the.I redoof \s-2INTERLISP\s0.While incorporating many features of other shells which makewriting shell programs (shell scripts) easier,most of the features unique to.I cshare designed more for the interactive \s-2UNIX\s0 user..PP\s-2UNIX\s0users who have read a general introduction to the systemwill find a valuable basic explanation of the shell here.Simple terminal interaction with.I cshis possible after reading just the first section of this document.The second section describes the shell's capabilities which you canexplore after you have begun to become acquainted with the shell.Later sections introduce features which are useful, but not necessaryfor all users of the shell..PPAdditional information includes an appendix listing special characters of the shelland a glossary of terms and commands introduced in this manual..AE.SH.if n .NDIntroduction.PPA.I shellis a command language interpreter..I Cshis the name of one particular command interpreter on\s-2UNIX\s0.The primary purpose of.I cshis to translate command lines typed at a terminal intosystem actions, such as invocation of other programs..I Cshis a user program just like any you might write.Hopefully,.I cshwill be a very useful program for youin interacting with the \s-2UNIX\s0 system..PPIn addition to this document, you will want to refer to a copyof the \s-2UNIX\s0 User Reference Manual.The.I cshdocumentation in section 1 of the manual provides a full description of allfeatures of the shell and is the definitive reference for questionsabout the shell..PPMany words in this document are shown in.I italics.These are important words;names of commands, and words which have special meaning in discussingthe shell and \s-2UNIX\s0.Many of the words are defined in a glossary at the end of this document.If you don't know what is meant by a word, you should lookfor it in the glossary..SHAcknowledgements.PPNumerous people have provided good input about previous versionsof .I cshand aided in its debugging and in the debugging of its documentation.I would especially like to thank Michael Ubellwho made the crucial observation that history commands could bedone well over the word structure of input text, and implementeda prototype history mechanism in an older version of the shell.Eric Allman has also provided a large number of useful comments on theshell, helping to unify those concepts which are present and to identifyand eliminate useless and marginally useful features.Mike O'Brien suggested the pathname hashingmechanism which speeds command execution.Jim Kulp added the job control and directory stack primitives andadded their documentation to this introduction..br.bp.NHTerminal usage of the shell.NH 2The basic notion of commands.PPA.I shellin\s-2UNIX\s0acts mostly as a medium through which other.I programsare invoked.While it has a set of.I builtinfunctions which it performs directly,most commands cause execution of programs that are, in fact,external to the shell.The shell is thus distinguished from the command interpreters of othersystems both by the fact that it is just a user program, and by the factthat it is used almost exclusively as a mechanism for invoking other programs..PP.I Commandsin the \s-2UNIX\s0 system consist of a list of strings or.I wordsinterpreted as a.I "command name"followed by.I arguments.Thus the command.DSmail bill.DEconsists of two words.The first word.I mailnames the command to be executed, in this case themail program which sends messages to other users.The shell uses the name of the command in attempting to execute it for you.It will look in a number of.I directoriesfor a file with the name.I mailwhich is expected to contain the mail program..PPThe rest of the words of the command are given as.I argumentsto the command itself when it is executed.In this case we specified also the argument.I billwhich is interpreted by the.I mailprogram to be the name of a user to whom mail is to be sent.In normal terminal usage we might use the.I mailcommand as follows..DS% mail billI have a question about the csh documentation.My document seems to be missing page 5.Does a page five exist?	BillEOT%.DE.PPHere we typed a message to send to.I billand ended this message with a ^D which sent an end-of-file tothe mail program.(Here and throughout this document, the notation ``^\fIx\fR''is to be read ``control-\fIx\fR'' and represents the striking of the \fIx\fRkey while the control key is held down.)The mail programthen 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..PPAfter typing the `% ' prompt the shell was reading command input fromour terminal.We typed a complete command `mail bill'.The shell then executed the.I mailprogram with argument.I billand went dormant waiting for it to complete.The mail program then read input from our terminal until we signalledan end-of-file via typing a ^D after which the shell noticedthat mail had completedand signaled us that it was ready to read from the terminal again byprinting another `% ' prompt..PPThis is the essential pattern of all interaction with \s-2UNIX\s0through the shell.A complete command is typed at the terminal, the shell executesthe command and when this execution completes, it prompts for a new command.If you run the editor for an hour, the shell will patiently wait foryou to finish editing and obediently prompt you again whenever you finishediting..PPAn example of a useful command you can execute now is the.I tsetcommand, which sets the default.I eraseand.I killcharacters on your terminal \- the erase character erases the lastcharacter you typed and the kill character erases the entire line youhave entered so far.By default, the erase character is the delete key (equivalent to `^?')and the kill character is `^U'.  Some people prefer to make the erase characterthe backspace key (equivalent to `^H').You can make this be true by typing.DStset \-e.DEwhich tells the program.I tsetto set the erase character to tset's default setting for this character(a backspace)..NH 2Flag arguments.PPA useful notion in \s-2UNIX\s0 is that of a.I flagargument.While many arguments to commands specify file names or user names,some arguments rather specify an optional capability of the commandwhich you wish to invoke.By convention, such arguments begin with the character `\-' (hyphen).Thus the command.DSls.DEwill produce a list of the files in the current.I "working directory" .The option.I \-sis the size option, and.DSls \-s.DEcauses.I lsto also give, for each file the size of the file in blocks of 512characters.The manual section for each command in the \s-2UNIX\s0 reference manualgives the available options for each command.The.I lscommand has a large number of useful and interesting options.Most other commands have either no options or only one or two options.It is hard to remember options of commands which are not used veryfrequently, so most \s-2UNIX\s0 utilities perform only one or two functionsrather than having a large number of hard to remember options..NH 2Output to files.PPCommands that normally read input or write output on the terminal can also be executed with this input and/or output done toa file..PPThus suppose we wish to save the current date in a file called `now'.The command.DSdate.DEwill print the current date on our terminal.This is because our terminal is the default.I "standard output"for the date command and the date command prints the date on itsstandard output.The shell lets us.I redirectthe.I "standard output"of a command through anotation using the.I metacharacter`>' and the name of the file where output is to be placed.Thus the command.DSdate > now.DEruns the.I datecommand such that its standard output isthe file `now' rather than the terminal.Thus this command places the current date and time into the file `now'.It is important to know that the.I datecommand was unaware that its output was going to a file rather thanto the terminal.The shell performed this.I redirectionbefore the command began executing..PPOne other thing to note here is that the file `now'need not have existed before the.I datecommand was executed; the shell would have created the file if it didnot exist.And if the file did exist?

⌨️ 快捷键说明

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