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

📄 ksh.1

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 1
📖 第 1 页 / 共 5 页
字号:
0 through 1023.Arrays need not be declared.Any reference to a named parameterwith a valid subscript islegal and an array will be created if necessary.Referencing an array without a subscriptis equivalent to referencing the element zero..PPThe.I valueof a.IR name d parameter may also be assigned by writing:.RS.PP.IB name = value\^\|\*(OK.IB name = value\*(CK .\|.\|..RE.PP.PD 0If the integer attribute,.BR \-i ,is set for.I namethe.I valueis subject to arithmetic evaluation as described below..PPPositional parameters,parameters denoted by a number,may be assigned values with the.PN setspecial command.  Parameter $0is set from argument zero when the shellis invoked..PPThe character.B $is used to introduce substitutable.IR parameters ..TP\fB${\fP\fIparameter\^\fP\fB}\fPThe shellreads all the characters from.B ${to the matching.B }as part of the same word even if it containsbraces or metacharacters.The value, if any, of the parameter is substituted.The braces are required when.I parameteris followed by a letter, digit, or underscorethat is not to be interpreted as part of its nameor when a named parameter is subscripted.If.I parameteris one or more digits then it is a positional parameter.A positional parameter of more than one digit must beenclosed in braces.If.I parameteris.BR \(**or.BR @ ,then all the positionalparameters, starting with.BR $1 ,are substituted(separated by a field separator character).If an array.I identifierwith subscript.B \(**or.B @is used,then the valuefor each of theelementsis substituted(separated by a field separator character)..TP\fB${#\fP\fIparameter\^\fP\fB}\fPIf.I parameteris.B \(**or.BR @ ,the number of positional parameters is substituted.Otherwise, the length of the value of the.I parameteris substituted..TP\fB${#\fP\fIidentifier\fP\fB[*]}\fPThe number of elements in the array.I identifieris substituted..TP\fB${\fP\fIparameter\^\fP\fB:\-\fP\fIword\^\fP\fB}\fPIf.I parameteris set and is non-null then substitute its value;otherwise substitute.IR word ..TP\fB${\fP\fIparameter\^\fP\fB:=\fP\fIword\^\fP\fB}\fPIf.I parameteris not set or is null then set it to.IR word ;the value of the parameter is then substituted.Positional parameters may not be assigned toin this way..TP\fB${\fP\fIparameter\^\fP\fB:?\fP\fIword\^\fP\fB}\fPIf.I parameteris set and is non-null then substitute its value;otherwise, print.I wordand exit from the shell.If.I wordis omitted then a standard message is printed..TP\fB${\fP\fIparameter\^\fP\fB:+\fP\fIword\^\fP\fB}\fPIf.I parameteris set and is non-null then substitute.IR word ;otherwise substitute nothing..TP.PD 0\fB${\fP\fIparameter\^\fP\fB#\fP\fIpattern\^\fP\fB}\fP.TP\fB${\fP\fIparameter\^\fP\fB##\fP\fIpattern\^\fP\fB}\fP.PDIfthe Shell.I patternmatches the beginning of the value of.IR parameter ,then the value ofthis substitution is the value of the.I parameterwith the matched portion deleted;otherwise the value of this.I parameteris substituted.In the first form the smallest matching pattern is deleted and in thesecond form the largest matching pattern is deleted..TP.PD 0\fB${\fP\fIparameter\^\fP\fB%\fP\fIpattern\^\fP\fB}\fP.TP\fB${\fP\fIparameter\^\fP\fB%%\fP\fIpattern\^\fP\fB}\fP.PDIfthe Shell.I patternmatches the end of the value of.IR parameter ,then the value ofthis substitution is the value of the.I parameterwith the matched part deleted;otherwise substitute the value of.IR parameter .In the first form the smallest matching pattern is deleted and in thesecond form the largest matching pattern is deleted..PD.PPIn the above,.I wordis not evaluated unless it isto be used as the substituted string,so that, in the following example,.PN pwdis executed only if.B dis not set or is null:.RS.PP.B "echo \|${d:\-\^$(\^pwd\^)\^}".RE.PPIf the colon (.B : )is omitted from the above expressions,then the shell only checks whether.I parameteris set or not..PPThe following parameters are automatically set by the shell:.RS.PD 0.TP 10.B #The number of positional parameters in decimal..TP.B \-Flags supplied to the shell on invocation or bythe.PN setcommand..TP.B ?The decimal value returned by the last executed command..TP.B $The process number of this shell..TP.B _Initially, the value.B _is an absolute pathname of the shell or script being executedas passed in the.IR environment .Subsequently it is assigned the last argument of the previous command.This parameter is not set for commands which are asynchronous.file when checking for mail..TP.B !The process number of the last background command invoked..TP.SM ERRNOThe value of errno as set by the most recently failed system call.This valueis system dependent and is intended for debugging purposes..TP.SM LINENOThe line number of the current line within the script orfunction being executed..TP.SM OLDPWDThe previous working directory set by the.PN cdcommand..TP.SM OPTARGThe value of the last option argument processed by the.PN getoptsspecial command..TP.SM OPTINDThe index of the last option argument processed by the.PN getoptsspecial command..TP.SM PPIDThe process number of the parent of the shell..TP.SM PWDThe present working directory set by the.PN cdcommand..TP.SM RANDOMEach time this parameter is referenced, a random integer,uniformly distributed between 0 and 32767, is generated.The sequence of random numbers can be initialized by assigninga numeric value toRANDOM..TP.SM REPLYThis parameter is set by the.B selectstatement and bythe.B readspecial command when no arguments are supplied..TP.SM SECONDSEach time this parameter is referenced, the number ofseconds since shell invocation is returned.If this parameter isassigned a value, then the value returned upon reference willbe the value that was assigned plus the number of seconds since the assignment..PD.RE.PPThe following parameters are used by the shell:.RS.PD 0.TP.SM CDPATHThe search path for the.PN cdcommand..TP.SM COLUMNSIf this variable is set,the value is used to define the width of the edit windowfor the shell edit modes and for printing.B selectlists..TP.SM EDITORIf the value of this variable ends in.IR emacs ,.IR gmacs ,or.I viand the.SM VISUALvariable is not set,then the corresponding option(see Special Command.B setbelow)will be turned on..TP.SM ENVIf this parameter is set, thenparameter substitution is performed onthe value to generatethe pathname of the script that will beexecuted when the.I shellis invoked.(See.I Invocationbelow.)This file is typically used for.I aliasand.I functiondefinitions..TP.SM FCEDITThe default editor name for the.B fccommand..TP.SM FPATHThe search path for function definitions.This path is searched when a function with the.B \-uattribute is referenced and when a command is not found.If an executable file is found, then it is read and executedin the current environment..TP.SM IFSInternal field separators,normally.BR space ,.BR tab ,and.B new-linethat is used to separate command words which result fromcommand or parameter substitutionand for separating words with the special command.BR read .The first character of the.SM IFSparameter is used to separate arguments for the.B "$\(**"substitution (See.I Quotingbelow)..TP.SMHISTFILEIf this parameter is set when the shell is invoked, thenthe value is the pathname of the file that will beused to store the command history.(See.I "Command re-entry"below.).TP.SM HISTSIZEIf this parameter is set when the shell is invoked, thenthe number of previously entered commands thatare accessible by this shellwill be greater than or equal to this number.The default is 128..TP.SM HOMEThe default argument (home directory) for the.B cdcommand..TP.SM LINESIf this variable is set,the value is used to determine the column length for printing.B selectlists.Select lists will print vertically until about two-thirds of.SM LINESlines are filled..TP.SM LOGNAMEThe name of the user's login account, corresponding to the login namein the user database..TP.SM MAILIf this parameter is set to the name of a mail file.I andthe.SM MAILPATHparameter is not set,then the shell informs the user of arrival of mailin the specified file..TP.SM MAILCHECKThis variable specifies how often (in seconds) theshell will check for changes in the modification timeof any of the files specified by the.SM MAILPATHor.SM MAILparameters.The default value is 600 seconds.When the time has elapsedthe shell will check before issuing the next prompt..TP.SM MAILPATHA colon (.B :)separated list of file names.If this parameter is setthen the shell informs the user ofany modifications to the specified filesthat have occurred within the last.SM MAILCHECKseconds.Each file name can be followed by a.B ?and a message that will be printed.The message will undergo parameter substitutionwith the parameter,.B $_defined as the name of the file that has changed.The default message is.I you have mail in $_..TP.SM PATHThe search path for commands (see.I Executionbelow).The user may not change.B \s-1PATH\s+1if executing under.PN rksh(except in.I .profile)..TP.SM PS1The value of this parameter is expanded for parametersubstitution to define theprimary prompt string which by default is.RB `` "$ \|" ''.The character.B !in the primary prompt string is replaced by the.I commandnumber (see.I Command Re-entrybelow)..TP.SM PS2Secondary prompt string, by default.RB `` "> \|" ''..TP.SM PS3Selection prompt stringused within a.B selectloop, by default.RB `` "#? \|" ''..TP.SM PS4The value of this parameter is expanded for parametersubstitution and precedes each line of an execution trace.If omitted, the execution trace prompt is.RB `` "+ \|" ''..TP.SM SHELLThe pathname of the.I shellis kept in the environment.At invocation, if the basename of this variable matches the pattern.BR *r*sh ,then the shell becomes restricted..TP.SM TMOUTIf set to a value greater than zero,the shell will terminate if a command is not entered withinthe prescribed number of seconds after issuing the.SM PS1prompt.(Note that the shell can be compiled with a maximum boundfor this value which cannot be exceeded.).TP.SM VISUALIf the value of this variable ends in.IR emacs ,.IR gmacs ,or.I vithen the corresponding option(see Special Command.B setbelow)will be turned on..PD.RE.PPThe shell gives default values to\fB\s-1PATH\s+1\fP, \fB\s-1PS1\s+1\fP, \fB\s-1PS2\s+1\fP, \fB\s-1MAILCHECK\s+1\fP,\fB\s-1TMOUT\s+1\fP and \fB\s-1IFS\s+1\fP,while.SM HOME,.SM SHELL.SM ENVand.SM MAILarenot set at all by the shell (although.SM HOME.I isset by.IR login (1)).On some systems.SM MAILand.SM SHELLare alsoset by.IR login (1))..SS Blank Interpretation.After parameter and command substitution,the results of substitutions are scanned for the field separatorcharacters (those found in.SM.B IFS)and split into distinct arguments where such characters are found.Explicit null arguments (\^\fB"\^"\fP or \fB\*\(fm\^\*\(fm\fP\^) are retained.Implicit null arguments(those resulting from.I parametersthat have no values) are removed..SS File Name Generation.Following substitution, each command.I wordis scanned forthe characters.BR \(** ,.BR ? ,and.B \*(OKunless the.B \-foption has been.BR set .If one of these characters appearsthen the word is regarded as a.IR pattern .The word is replaced with lexicographically sorted file names that match the pattern.If no file name is found that matches the pattern, thenthe word is left unchanged.When a.I patternis used for file name generation,the character.B .at the start of a file nameor immediately following a.BR / ,as well as the character.B /itself,must be matched explicitly.In other instances of pattern matching the.B /and.B .are not treated specially..PP.PD 0.RS.TP.B \(**Matches any string, including the null string..TP.B ?Matches any single character..TP.BR \*(OK \^.\|.\|.\^ \*(CKMatches any one of the enclosed characters.A pair of characters separated by.B \-matches anycharacter lexically between the pair, inclusive.If the first character following the opening "[ \|"is a "! \|" then any character not enclosed is matched.A.B \-can be included in the character set by putting it as thefirst or last character.

⌨️ 快捷键说明

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