📄 sh5.1
字号:
searched for.IR arg .The.MS cd 1command may not be executed by.PN rsh5 ..br.ne 2.1v.TP\fBecho\fP [ \fIarg\fP... ].NXR "echo command (System V)"Echo arguments. See.MS echo 1sh5 for usage and description..TP\fBeval\fP [ \fIarg\fP... ].NXR "eval command (System V)"The arguments are read as inputto the shelland the resulting command(s) executed..TP\fBexec\fP [ \fIarg\fP... ].NXR "exec command (System V)"The command specified bythe arguments is executed in place of this shellwithout creating a new process.Input/output arguments may appear and, if no otherarguments are given, cause the shellinput/output to be modified..TP\fBexit\fP [ \fIn\fP ] .NXR "exit command (System V)"Causes a shell to exitwith the exit status specified by.IR n .If.I n\^is omitted the exit status is that of the last command executed(an end-of-file will also cause the shell to exit.).TP\fBexport\fP [ \fIname\fP... ].NXR "export command (System V)"Each given.I name is marked for automatic export to the environmentof subsequently-executed commands.If no arguments are given, a list of allnames that are exported in this shell is printed.Function names may .I notbe exported..TP\fBhash\fP [ \fB\-r\fP ] [ \fIname\fP... ] .NXR "hash command (System V)"For each .IR name\^ ,the location in the search path of the command specified by .I name\^is determined and remembered by the shell.The .B \-roption causes the shell to forget all remembered locations.If no arguments are given, information about remembered commands ispresented.\fIHits\fP is the number of times a command has been invoked by the shell process.\fICost\fP is a measure of the work required to locate acommand in the search path. There are certain situations which require that the stored locationof a command be recalculated.Commands for which this will be done are indicated by an asterisk (\fB*\fR)adjacent to the \fIhits\fR information.\fICost\fR will be incremented when the recalculation is done..TP\fBpwd\fP.NXR "pwd command (System V)"Print the current working directory.For use and description, see .MS pwd 1 ..TP\fBread\fP [ \fIname\fP... ] .NXR "read command (System V)"One line is read from the standard input andthe firstword is assigned to the first.IR name ,the second wordto the second.IR name ,etc., with leftover words assigned to the last.IR name .The return code is 0 unless an end-of-file is encountered..TP\fBreadonly\fP [ \fIname\fP... ] .NXR "readonly command (System V)"The given.IR name sare marked.I readonly\^andthe values of the these.IR name smay not be changedby subsequent assignment.If no arguments are given, a listof all.I readonly\^names is printed..TP\fBreturn\fP [ \fIn\fP ].NXR "return command (System V)"Causes a function to exit with the return value specified by.IR n .If.I n is omitted, the return status is that of the last command executed..TP\fBset\fP [ \fB\-\-aefhkntuvx\fP [ \fIarg\fP... ] ] .NXR "set command (System V)".RS.TP.B \-aMark variables which are modified or created for export..TP.B \-eExit immediately if a commandexits with a nonzero exit status..TP.B \-fDisable file name generation.TP.B \-hLocate and remember function commands as functions are defined (function commands are normally located when the function is executed)..TP.B \-kAll keyword arguments are placed in the environment for a command,not just those that precede the command name..TP.B \-nRead commands but do not execute them..TP.B \-tExit after reading and executing one command..TP.B \-uTreat unset variables as an error when substituting..TP.B \-vPrint shell input lines as they are read..TP.B \-xPrint commands and their arguments as they are executed..TP.B \-\-Do not change any of the flags; useful in setting.B $1to.BR \- ..PPUsing.B \+rather than.B \-causes these flags to be turned off.These flags can also be used upon invocation of the shell.The current set of flags may be found in.BR $\- .The remaining arguments are positionalparameters and are assigned, in order, to.BR $1 ,.BR $2 ,\&.\|.\|.\|.If no arguments are given the valuesof all names are printed..RE.TP\fBshift\fP [ \fIn\fP ] .NXR "shift command (System V)".brThe positional parameters from.B $n+1\&.\|.\|.are renamed.B $1\&.\|.\|.\|.If.I n\^is not given, it is assumed to be 1..TP\fBtest\fP.NXR "test command (System V)".brEvaluate conditional expressions. For usage and description, see .MS test 1sh5 ..TP\fBtimes\fP.NXR "times command (System V)".brPrint the accumulated user and system times for processesrun from the shell..TP\fBtrap\fP [ \fIarg\fP ] [ \fIn\fP... ] .NXR "trap command (System V)"The command.I arg\^is to be read and executed when the shellreceives signal(s).IR n .Note that.I arg\^is scanned once whenthe trap is set and once when the trapis taken.Trap commands are executed in order of signal number.Any attempt to set a trap on a signal thatwas ignored on entry to the current shellis ineffective.An attempt to trap on signal 11 (memory fault) produces an error.If.I arg\^is absent all trap(s).I n\^are resetto their original values.If.I arg\^is the nullstring this signal is ignored by the shell and by the commandsit invokes.If.I n\^is 0 the command.I arg\^is executedon exit from the shell.The.B trapcommandwith no arguments prints a listof commands associated with each signal number..TP\fBtype\fP [ \fIname\^\fP... ] .NXR "type command (System V)"For each.IR name ,indicate how it would be interpreted if used as a command name..TP\fBulimit\fP [ \fB\-fp\fP ] [ \fIn\fP ] .NXR "ulimit command (System V)"imposes a size limit of.I n\^.RS.TP.B \-fimposes a size limit of .I nblocks on files written by child processes (files of any size may be read).With no argument, the current limit is printed..TP.B \-pchanges the pipe size to.I n(\s-1UNIX\s+1/\s-1RT\s+1 only)..PPIf no option is given,.B \-fis assumed..RE.TP\fBumask\fP [ \fInnn\fP ] .NXR "umask command (System V)"The user file-creation mask is set to.I nnn\^.For further information, see.MS umask 2 .If.I nnn\^is omitted, the current value of the mask is printed..TP\fBunset\fP [ \fIname\fP... ] .NXR "unset command (System V)"For each .IR name , remove the corresponding variable or function.The variables \fB\s-1PATH\s+1\fP, \fB\s-1PS1\s+1\fP, \fB\s-1PS2\s+1\fP, \fB\s-1MAILCHECK\s+1\fP and \fB\s-1IFS\s+1\fPcannot be unset..TP\fBwait\fP [ \fIn\fP ] .NXR "wait command (System V)"Wait for the specified process and report its termination status.If.I n\^is not given all currently active child processes are waited forand the return code is zero..PD.PP.SS Invocation.NXR "sh5 command interpreter" "invoking"If the shell is invoked through.MS execve 2and the first character of argument zerois.BR \- ,commands are initially read from.B /etc/profileand from.BR \s-1$HOME\s+1/.profile ,if such files exist.Thereafter, commands are read as described below, whichis also the case when the shell is invoked as.BR /bin/sh5 .The flags below are interpreted by the shell on invocation only. Notethat unless the .B \-cor.B \-sflag is specified, the first argument is assumed to be thename of a file containing commands, and the remainingarguments are passed as positional parametersto that command file:.PP.PD 0.TP 10.BI \-c "\| string\^"If the.B \-cflag is presentcommands are read from.IR string ..TP.B \-sIf the.B \-sflag is present or if noarguments remaincommands are read from the standard input.Any remaining arguments specify the positional parameters.Shell output (except for .IR "Special Commands\^" )is written to file descriptor 2..TP.B \-iIf the.B \-iflag is present orif the shell input and output are attached to a terminal,this shell is.IR interactive .In this case \s-1TERMINATE\s+1 is ignored (so that \fBkill 0\fPdoes not kill an interactive shell) and \s-1INTERRUPT\s+1 is caught and ignored(so that.B waitis interruptible).In all cases, \s-1QUIT\s+1 is ignored by the shell..TP.B \-rIf the.B \-rflag is present the shell is a restricted shell..PD.PPThe remaining flags and arguments are described under the.B setcommand above..SS Rsh5 Only.NXR "rsh5 program" "restricted"The.PN rsh5shell is used to set up login names and execution environments whosecapabilities are more controlled than those of the standard shell.The actions of.PN rsh5are identical to those of.PN sh5,except that the following are disallowed:.RS.PD 0.PPchanging directory, see.MS cd 1,.brsetting the value of.SM.BR $PATH\*S,.brspecifying path orcommand names containing.BR / ,.brredirecting output.RB ( >and.BR >> )..PD.RE.PPThe restrictions above are enforcedafter \fB.profile\fP is interpreted..PPWhen a command to be executed is found to be a shell procedure,.PN rsh5invokes.PN sh5to execute it.Thus, it is possible to provide to the end-user shell procedures that have access to the full power ofthe standard shell,while imposing a limited menu of commands.This scheme assumes that the end-user does not have write andexecute permissions in the same directory..PPThe net effect of these rules is that the writer of the.B .profilehas complete control over user actions,by performing guaranteed setup actionsand leaving the user in an appropriate directory(probablynotthe login directory)..PPThe system administrator often sets up a directoryof commands(/usr/rbin )that can be safely invoked by.PN rsh5.Some systems also provide a restricted editor,.PN red ,see.MS ed 1..SH Exit Status.NXR "sh5 command interpreter" "exit status"Errors detected by the shell, such as syntax errors,cause the shellto return a nonzero exit status.If the shell is being used noninteractivelyexecution of the shell file is abandoned.Otherwise, the shell returns the exit status ofthe last command executed (see also the.B exitcommand above)..SH Restrictions.NXR "sh5 command interpreter" "restricted"If a command is executed, and a command with the same name is installed in a directory in the search path before the directory where theoriginal command was found, the shell will continue to .I exec\^the original command.Use the .B hashcommand to correct this situation..PPIf you move the current directory or one above it, .B pwd\^may not give the correct response.Use the .PN cd\^command with a full path nameto correct this situation..PPIf you startup a shell using .MS execve 2 with an 'r' in the .I argv[0]string, the System V shell goes into restricted mode..SH Files/etc/profile.br\s-1$HOME\s+1/\fB.\fPprofile.br/tmp/sh\(**.br/dev/null.SH See Alsocd(1), echo(1sh5),login(1), printenv(1), pwd(1), sh(1), test(1sh5)dup(2), execve(2), fork(2), pipe(2), ulimit(2), umask(2), wait(2), signal(3), a.out(5), environ(7) .NXE "sh5 command interpreter"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -