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

📄 bash.1

📁 android-w.song.android.widget
💻 1
📖 第 1 页 / 共 5 页
字号:
.\".\" MAN PAGE COMMENTS to.\".\"	Chet Ramey.\"	Case Western Reserve University.\"	chet@po.cwru.edu.\".\"	Last Change: Tue Dec 28 13:41:43 EST 2010.\".\" bash_builtins, strip all but Built-Ins section.if \n(zZ=1 .ig zZ.if \n(zY=1 .ig zY.TH BASH 1 "2010 December 28" "GNU Bash-4.2".\".\" There's some problem with having a `@'.\" in a tagged paragraph with the BSD man macros..\" It has to do with `@' appearing in the }1 macro..\" This is a problem on 4.3 BSD and Ultrix, but Sun.\" appears to have fixed it..\" If you're seeing the characters.\" `@u-3p' appearing before the lines reading.\" `possible-hostname-completions.\" and `complete-hostname' down in READLINE,.\" then uncomment this redefinition..\".de }1.ds ]X \&\\*(]B\\.nr )E 0.if !"\\$1"" .nr )I \\$1n.}f.ll \\n(LLu.in \\n()Ru+\\n(INu+\\n()Iu.ti \\n(INu.ie !\\n()Iu+\\n()Ru-\w\\*(]Xu-3p \{\\*(]X.br\}.el \\*(]X\h|\\n()Iu+\\n()Ru\c.}f...\".\" File Name macro.  This used to be `.PN', for Path Name,.\" but Sun doesn't seem to like that very much..\".de FN\fI\|\\$1\|\fP...SH NAMEbash \- GNU Bourne-Again SHell.SH SYNOPSIS.B bash[options][file].SH COPYRIGHT.if n Bash is Copyright (C) 1989-2011 by the Free Software Foundation, Inc..if t Bash is Copyright \(co 1989-2011 by the Free Software Foundation, Inc..SH DESCRIPTION.B Bashis an \fBsh\fR-compatible command language interpreter thatexecutes commands read from the standard input or from a file..B Bashalso incorporates useful features from the \fIKorn\fP and \fIC\fPshells (\fBksh\fP and \fBcsh\fP)..PP.B Bashis intended to be a conformant implementation of theShell and Utilities portion of the IEEE POSIX specification(IEEE Standard 1003.1)..B Bashcan be configured to be POSIX-conformant by default..SH OPTIONSAll of the  single-character shell options documented in thedescription of the \fBset\fR builtin command can be used as optionswhen the shell is invoked.In addition, \fBbash\fRinterprets the following options when it is invoked:.PP.PD 0.TP 10.BI \-c "\| string\^"If the.B \-coption is present, then commands are read from.IR string .If there are arguments after the.IR string ,they are assigned to the positional parameters, starting with.BR $0 ..TP.B \-iIf the.B \-ioption is present, the shell is.IR interactive ..TP.B \-lMake.B bashact as if it had been invoked as a login shell (see.SM.B INVOCATIONbelow)..TP.B \-rIf the.B \-roption is present, the shell becomes.I restricted(see.SM.B "RESTRICTED SHELL"below)..TP.B \-sIf the.B \-soption is present, or if no arguments remain after optionprocessing, then commands are read from the standard input.This option allows the positional parameters to be setwhen invoking an interactive shell..TP.B \-DA list of all double-quoted strings preceded by \fB$\fPis printed on the standard output.These are the strings thatare subject to language translation when the current localeis not \fBC\fP or \fBPOSIX\fP.This implies the \fB\-n\fP option; no commands will be executed..TP.B [\-+]O [\fIshopt_option\fP]\fIshopt_option\fP is one of the shell options accepted by the\fBshopt\fP builtin (see.SM.B SHELL BUILTIN COMMANDSbelow).If \fIshopt_option\fP is present, \fB\-O\fP sets the value of that option;\fB+O\fP unsets it.If \fIshopt_option\fP is not supplied, the names and values of the shelloptions accepted by \fBshopt\fP are printed on the standard output.If the invocation option is \fB+O\fP, the output is displayed in a formatthat may be reused as input..TP.B \-\-A.B \-\-signals the end of options and disables further option processing.Any arguments after the.B \-\-are treated as filenames and arguments.  An argument of.B \-is equivalent to \fB\-\-\fP..PD.PP.B Bashalso interprets a number of multi-character options.These options must appear on the command line before thesingle-character options to be recognized..PP.PD 0.TP.B \-\-debuggerArrange for the debugger profile to be executed before the shellstarts.Turns on extended debugging mode (see the description of the.B extdebugoption to the.B shoptbuiltin below)..TP.B \-\-dump\-po\-stringsEquivalent to \fB\-D\fP, but the output is in the GNU \fIgettext\fP\fBpo\fP (portable object) file format..TP.B \-\-dump\-stringsEquivalent to \fB\-D\fP..TP.B \-\-helpDisplay a usage message on standard output and exit successfully..TP\fB\-\-init\-file\fP \fIfile\fP.PD 0.TP\fB\-\-rcfile\fP \fIfile\fP.PDExecute commands from.I fileinstead of the standard personal initialization file.I ~/.bashrcif the shell is interactive (see.SM.B INVOCATIONbelow)..TP.B \-\-loginEquivalent to \fB\-l\fP..TP.B \-\-noeditingDo not use the GNU.B readlinelibrary to read command lines when the shell is interactive..TP.B \-\-noprofileDo not read either the system-wide startup file.FN /etc/profileor any of the personal initialization files.IR ~/.bash_profile ,.IR ~/.bash_login ,or.IR ~/.profile .By default,.B bashreads these files when it is invoked as a login shell (see.SM.B INVOCATIONbelow)..TP.B \-\-norcDo not read and execute the personal initialization file.I ~/.bashrcif the shell is interactive.This option is on by default if the shell is invoked as.BR sh ..TP.B \-\-posixChange the behavior of \fBbash\fP where the default operation differsfrom the POSIX standard to match the standard (\fIposix mode\fP)..TP.B \-\-restrictedThe shell becomes restricted (see.SM.B "RESTRICTED SHELL"below)..TP.B \-\-verboseEquivalent to  \fB\-v\fP..TP.B \-\-versionShow version information for this instance of.B bashon the standard output and exit successfully..PD.SH ARGUMENTSIf arguments remain after option processing, and neither the.B \-cnor the.B \-soption has been supplied, the first argument is assumed tobe the name of a file containing shell commands.If.B bashis invoked in this fashion, .B $0is set to the name of the file, and the positional parametersare set to the remaining arguments..B Bashreads and executes commands from this file, then exits.\fBBash\fP's exit status is the exit status of the last commandexecuted in the script.If no commands are executed, the exit status is 0.An attempt is first made to open the file in the current directory, and,if no file is found, then the shell searches the directories in.SM.B PATHfor the script..SH INVOCATIONA \fIlogin shell\fP is one whose first character of argument zero is a.BR \- ,or one started with the .B \-\-loginoption..PPAn \fIinteractive\fP shell is one started without non-option argumentsand without the.B \-coptionwhose standard input and error areboth connected to terminals (as determined by.IR isatty (3)),or one started with the.B \-ioption..SM.B PS1is set and.B $\-includes.B iif.B bashis interactive,allowing a shell script or a startup file to test this state..PPThe following paragraphs describe how.B bashexecutes its startup files.If any of the files exist but cannot be read,.B bashreports an error.Tildes are expanded in file names as described below under.B "Tilde Expansion"in the.SM.B EXPANSIONsection..PPWhen.B bashis invoked as an interactive login shell, or as a non-interactive shellwith the \fB\-\-login\fP option, it first reads andexecutes commands from the file \fI/etc/profile\fP, if thatfile exists.After reading that file, it looks for \fI~/.bash_profile\fP,\fI~/.bash_login\fP, and \fI~/.profile\fP, in that order, and readsand executes commands from the first one that exists and is readable.The.B \-\-noprofileoption may be used when the shell is started to inhibit this behavior..PPWhen a login shell exits,.B bashreads and executes commands from the file \fI~/.bash_logout\fP, if itexists..PPWhen an interactive shell that is not a login shell is started,.B bashreads and executes commands from \fI~/.bashrc\fP, if that file exists.This may be inhibited by using the.B \-\-norcoption.The \fB\-\-rcfile\fP \fIfile\fP option will force.B bashto read and execute commands from \fIfile\fP instead of \fI~/.bashrc\fP..PPWhen.B bashis started non-interactively, to run a shell script, for example, itlooks for the variable.SM.B BASH_ENVin the environment, expands its value if it appears there, and uses theexpanded value as the name of a file to read and execute..B Bashbehaves as if the following command were executed:.sp .5.RS.if t \f(CWif [ \-n "$BASH_ENV" ]; then . "$BASH_ENV"; fi\fP.if n if [ \-n "$BASH_ENV" ]; then . "$BASH_ENV"; fi.RE.sp .5but the value of the.SM.B PATHvariable is not used to search for the file name..PPIf.B bashis invoked with the name.BR sh ,it tries to mimic the startup behavior of historical versions of.B shas closely as possible,while conforming to the POSIX standard as well.When invoked as an interactive login shell, or a non-interactiveshell with the \fB\-\-login\fP option, it first attempts toread and execute commands from.I /etc/profileand.IR ~/.profile ,in that order.The.B \-\-noprofileoption may be used to inhibit this behavior.When invoked as an interactive shell with the name.BR sh ,.B bashlooks for the variable.SM.BR ENV ,expands its value if it is defined, and uses theexpanded value as the name of a file to read and execute.Since a shell invoked as.B shdoes not attempt to read and execute commands from any other startupfiles, the.B \-\-rcfileoption has no effect.A non-interactive shell invoked with the name.B shdoes not attempt to read any other startup files. When invoked as.BR sh ,.B bashenters.I posixmode after the startup files are read..PPWhen.B bashis started in.I posixmode, as with the.B \-\-posixcommand line option, it follows the POSIX standard for startup files.In this mode, interactive shells expand the.SM.B ENVvariable and commands are read and executed from the filewhose name is the expanded value.No other startup files are read..PP.B Bashattempts to determine when it is being run with its standard inputconnected to a network connection, as when executed by the remote shelldaemon, usually \fIrshd\fP, or the secure shell daemon \fIsshd\fP.If.B bashdetermines it is being run in this fashion, it reads and executescommands from \fI~/.bashrc\fP, if that file exists and is readable.It will not do this if invoked as \fBsh\fP.The.B \-\-norcoption may be used to inhibit this behavior, and the.B \-\-rcfileoption may be used to force another file to be read, but\fIrshd\fP does not generally invoke the shell with those optionsor allow them to be specified..PPIf the shell is started with the effective user (group) id not equal to thereal user (group) id, and the \fB\-p\fP option is not supplied, no startupfiles are read, shell functions are not inherited from the environment, the.SM.BR SHELLOPTS ,.SM.BR BASHOPTS ,.SM.BR CDPATH ,and.SM.B GLOBIGNOREvariables, if they appear in the environment, are ignored,and the effective user id is set to the real user id.If the \fB\-p\fP option is supplied at invocation, the startup behavior isthe same, but the effective user id is not reset..SH DEFINITIONS.PPThe following definitions are used throughout the rest of thisdocument..PD 0.TP.B blank A space or tab..TP.B wordA sequence of characters considered as a single unit by the shell.Also known as a.BR token ..TP.B nameA .I wordconsisting only of alphanumeric characters and underscores, andbeginning with an alphabetic character or an underscore.  Alsoreferred to as an

⌨️ 快捷键说明

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