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

📄 ksh.1

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 1
📖 第 1 页 / 共 5 页
字号:
.PD.REA.I pattern-listis a list of one or more patterns separated by each otherwith a.BR \(bv .Composite patterns can be formed with one or more of the following:.PD 0.RS.TP\fB?(\fP\fIpattern-list\^\fP\fB)\fPOptionally matches any one of the given patterns..TP\fB*(\fP\fIpattern-list\^\fP\fB)\fPMatches zero or more occurrences of the given patterns..TP\fB+(\fP\fIpattern-list\^\fP\fB)\fPMatches one or more occurrences of the given patterns..TP\fB\&@\&(\fP\fIpattern-list\^\fP\fB)\fPMatches exactly one of the given patterns..TP\fB!(\fP\fIpattern-list\^\fP\fB)\fPMatches anything, except one of the given patterns..PD.RE.SS Quoting.Each of the.I metacharacterslisted above (See.I Definitionsabove)has a special meaning to the shelland causes termination of a word unless quoted.A character may be.I quoted(that is, made to stand for itself)by precedingit with a.BR \e .The pair.B \enew-lineis ignored.All characters enclosed between a pair of single quote marks (\^\fB\(fm\^\(fm\fP\^),are quoted.A single quote cannot appear within single quotes.Inside double quote marks(\fB"\^"\fP),parameter and command substitution occurs and.B \equotes the characters.BR \e ,.BR \f(CW`\fP ,\fB"\fP,and.BR $ .The meaning of.B "$\(**"and.B "$@"is identical when not quoted or when used as a parameter assignment valueor as a file name.However, when used as a command argument,.B "$\(**"is equivalent to\fB"$1\fP\fId\fP\fB\|$2\fP\fId\fP\|.\|.\|.\fB"\fP,where.I dis the first character of the.SM.B IFSparameter, whereas.B "$@"is equivalent to.B "$1"\|"$2"\|\&.\|.\|.\^.Inside grave quote marks.Pn ( `` ).B \equotes the characters.BR \e ,.PN ` ,and.PP $ .If the grave quotes occur within double quotes then.BR \ealso quotes the character\fB"\fP..PPThe special meaning of reserved words or aliases can be removed by quoting anycharacter of the reserved word.The recognition of function names or special command names listed belowcannot be altered by quoting them..SS Arithmetic Evaluation.An ability to perform integer arithmeticis provided with the special command.BR let .Evaluations are performed using.I longarithmetic.Constants are of the form\*(OK\fIbase\fB#\^\fR\*(CK\fIn\^\fPwhere.I baseis a decimal number between two and thirty-sixrepresenting the arithmetic baseand.I nis a number in that base.If.I baseis omittedthen base 10 is used..PPAn arithmetic expression uses the same syntax, precedence, andassociativity ofexpression of the C language.All the integral operators,other than.BR ++ ,.BR \-\|\- ,.BR ?: ,and.B ,are supported.Named parameters can be referenced by name within an arithmetic expressionwithout using the parameter substitution syntax.When a named parameter is referenced, its value is evaluated asan arithmetic expression. .PPAn internal integer representation of a.I named parametercan be specified with the.B \-ioption of the.B typesetspecial command.Arithmetic evaluation is performed on the value of eachassignment to a named parameter with the.B \-iattribute.If you do not specify an arithmetic base,the first assignment to theparameter determines the arithmetic base.This base isused whenparameter substitution occurs..PPSince many of the arithmetic operators requirequoting, an alternative form of the.B letcommand is provided.For any command which begins with a.BR (( ,all the characters until a matching.B ))are treated as a quoted expression.More precisely,.BR (( .\|.\|. ))is equivalent to.B let\fB"\fP\|.\|.\|.\fB"\fP..SS Prompting.When used interactively,the shell prompts with the value of.SM.B PS1before reading a command.If at any time a new-line is typed and further input is neededto complete a command, then the secondary prompt(that is, the value of.BR \s-1PS2\s+1 )is issued..SS Conditional Expressions.A.I "conditional expression"is used with the.B [[compound command to test attributes of files and to comparestrings.Word splitting and file name generation arenot performed on the words between.B [[and.BR ]] .Each expression can be constructed from one or moreof the following unary or binary expressions:.PD 0.TP\fB\-a\fP \fIfile\fPTrue, if.I fileexists..TP\fB\-b\fP \fIfile\fPTrue, if.I fileexists and is a block special file..TP\fB\-c\fP \fIfile\fPTrue, if.I fileexists and is a character special file..TP\fB\-d\fP \fIfile\fPTrue, if.I fileexists and is a directory..TP\fB\-f\fP \fIfile\fPTrue, if.I fileexists and is an ordinary file..TP\fB\-g\fP \fIfile\fPTrue, if.I fileexists and is has its setgid bit set..TP\fB\-k\fP \fIfile\fPTrue, if.I fileexists and is has its sticky bit set..TP\fB\-n\fP \fIstring\fPTrue, if length of.I stringis non-zero..TP\fB\-o\fP \fIoption\fPTrue, if option named.I optionis on..TP\fB\-p\fP \fIfile\fPTrue, if.I fileexists and is a fifo special file or a pipe..TP\fB\-r\fP \fIfile\fPTrue, if.I fileexists and is readable by current process..TP\fB\-s\fP \fIfile\fPTrue, if.I fileexists and has size greater than zero..TP\fB\-t\fP \fIfildes\fPTrue, if file descriptor number.I fildesis open and associated with a terminal device..TP\fB\-u\fP \fIfile\fPTrue, if.I fileexists and is has its setuid bit set..TP\fB\-w\fP \fIfile\fPTrue, if.I fileexists and is writable by current process..TP\fB\-x\fP \fIfile\fPTrue, if.I fileexists and is executable by current process.If.I fileexists and is a directory, then the current processhas permission to search in the directory..TP\fB\-z\fP \fIstring\fPTrue, if length of.I stringis zero..TP\fB\-L\fP \fIfile\fPTrue, if.I fileexists and is a symbolic link..TP\fB\-O\fP \fIfile\fPTrue, if.I fileexists and is owned by the effective user id of this process..TP\fB\-G\fP \fIfile\fPTrue, if.I fileexists and its group matches the effective group id of this process..TP\fB\-S\fP \fIfile\fPTrue, if.I fileexists and is a socket..TP\fIfile1\fP \fB\-nt\fP \fIfile2\fPTrue, if.I file1exists and is newer than.IR file2 ..TP\fIfile1\fP \fB\-ot\fP \fIfile2\fPTrue, if.I file1exists and is older than.IR file2 ..TP\fIfile1\fP \fB\-ef\fP \fIfile2\fPTrue, if.I file1and .I file2exist and refer to the same file..TP\fIstring\fP \fB=\fP \fIpattern\fPTrue, if.I stringmatches.IR pattern ..TP\fIstring\fP \fB!=\fP \fIpattern\fPTrue, if.I stringdoes not match.IR pattern ..TP\fIstring1\fP \fB<\fP \fIstring2\fPTrue, if.I string1comes before.I string2based on ASCII value of their characters..TP\fIstring1\fP \fB>\fP \fIstring2\fPTrue, if.I string1comes after.I string2based on ASCII value of their characters..TP\fIexp1\fP \fB\-eq\fP \fIexp2\fPTrue, if.I exp1is equal to.IR exp2..TP\fIexp1\fP \fB\-ne\fP \fIexp2\fPTrue, if.I exp1is not equal to.IR exp2..TP\fIexp1\fP \fB\-lt\fP \fIexp2\fPTrue, if.I exp1is less than.IR exp2..TP\fIexp1\fP \fB\-gt\fP \fIexp2\fPTrue, if.I exp1is greater than.IR exp2..TP\fIexp1\fP \fB\-le\fP \fIexp2\fPTrue, if.I exp1is less than or equal to.IR exp2..TP\fIexp1\fP \fB\-ge\fP \fIexp2\fPTrue, if.I exp1is greater than or equal to.IR exp2..PD.PPIn each of the above expressions, if.I fileis of the form\fB/dev/fd/\fP\fIn\fP,where.I nis an integer,then the test applied to the open file whosedescriptor number is.IR n ..PPA compound expression can be constructed from these primitives byusing any of the following, listed in decreasing order of precedence..PD 0.TP\fB(\fP\fIexpression\fP\fB)\fPTrue, if.I expressionis true.Used to group expressions..TP\fB!\fP \fIexpression\fPTrue if.I expressionis false..TP\fIexpression1\fP \fB&&\fP \fIexpression2\fPTrue, if.I expression1and.I expression2are both true..TP\fIexpression1\fP \fB\(bv\(bv\fP \fIexpression2\fPTrue, if either.I expression1or.I expression2is true..PD.SS Input/output.Before a command is executed, its input and outputmay be redirected using a special notation interpreted by the shell.The following may appear anywhere in a simple-commandor may precede or follow a.I commandand are.I notpassed on to the invoked command.Command and parameter substitution occurs before.I wordor.I digitis used except as noted below.File name generationoccurs only if the pattern matches a single fileand blank interpretation is not performed..TP 14.BI < wordUse file.I wordas standard input (file descriptor 0)..TP.BI > wordUse file.I wordas standard output (file descriptor 1).If the file does not exist then it is created.If the file exists, and the.B noclobberoption is on,this causes an error;otherwise, it is truncated to zero length..TP.BI >| wordSames as.BR > ,except that it overrides the.B noclobberoption..TP.BI >> wordUse file.I wordas standard output.If the file exists then output is appended to it (by first seeking to the end-of-file);otherwise, the file is created..TP.BI <> wordOpen file.I wordfor reading and writingas standard input..TP\fB<<\fP\*(OK\fB\-\fP\*(CK\fIword\fPThe shell input is read up to a line that is the same as.IR word ,or to an end-of-file.No parameter substitution, command substitution orfile name generation is performed on.IR word .The resulting document,called a.IR here-document ,becomesthe standard input.If any character of.I wordis quoted, then no interpretationis placed upon the characters of the document;otherwise, parameter and command substitution occurs,.B \enew-lineis ignored,and.B \emust be used to quote the characters.BR \e ,.BR $ ,.Pn ` ,and the first character of.IR word .If.B \-is appended to.BR << ,then all leading tabs are stripped from.I wordand from the document..TP.BI <& digitThe standard input is duplicated from file descriptor.I digit(see.IR dup (2)).Similarly for the standard output using.BR >&.IR digit ..TP.B <&\-The standard input is closed.Similarly for the standard output using.BR >&\- ..TP.B <&pThe input from the co-process is moved to standard input..TP.B >&pThe output to the co-process is moved to standard output..PPIf one of the above is preceded by a digit,then thefile descriptor number referred to is that specifiedby the digit(instead of the default 0 or 1).For example:.RS.PP\&.\|.\|. \|2>&1.RE.PPmeans file descriptor 2 is to be openedfor writing as a duplicateof file descriptor 1..PPThe order in which redirections are specified is significant.The shell evaluates each redirection in terms of the.RI ( "file descriptor" ", " file )association at the time of evaluation.For example:.RS.PP\&.\|.\|. \|1>\fIfname\^\fP 2>&1.RE.PPfirst associates file descriptor 1 with file.IR fname .It then associates file descriptor 2 with the file associated with filedescriptor 1 (that is,.IR fname ).If the order of redirections were reversed, file descriptor 2 would be associatedwith the terminal (assuming file descriptor 1 had been) and then file descriptor1 would be associated with file.IR fname ..PPIf a command is followed by.B &and job control is not active,then the default standard inputfor the commandis the empty file.BR /dev/null .Otherwise, the environment for the execution of a command contains thefile descriptors of the invoking shell as modified byinput/output specifications..SS Environment.The.I environment(see.IR environ (7))is a list of name-value pairs that is passed toan executed program in the same way as a normal argument list.The names must be.I identifiersand the values are character strings.The shell interacts with the environment in several ways.On invocation, the shell scans the environmentand creates aparameterfor each name found,giving it the corresponding value and marking it.I export .Executed commands inherit the environment.If the user modifies the values of theseparametersor creates new ones,using the.B exportor.B typeset \-xcommands they become part of theenvironment.The environment seen by any executed command is thus composedof any name-value pairs originally inherited by the shell,whose values may be modified by the current shell,plus any additionswhich must be noted in.B export

⌨️ 快捷键说明

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