?? 01. unix note.txt
字號:
-P List current readline function names and bindings.
-v Display readline variable names and values in such a way that they can be re-
read.
-V List current readline variable names and values.
-s Display readline key sequences bound to macros and the strings they output in
such a way that they can be re-read.
-S Display readline key sequences bound to macros and the strings they output.
-f filename
Read key bindings from filename.
-q function
Query about which keys invoke the named function.
-u function
Unbind all keys bound to the named function.
-r keyseq
Remove any current binding for keyseq.
-x keyseq:shell-command
Cause shell-command to be executed whenever keyseq is entered.
The return value is 0 unless an unrecognized option is given or an error occurred.
break [n]
Exit from within a for, while, until, or select loop. If n is specified, break n
levels. n must be ≥ 1. If n is greater than the number of enclosing loops, all
enclosing loops are exited. The return value is 0 unless the shell is not executing
a loop when break is executed.
builtin shell-builtin [arguments]
Execute the specified shell builtin, passing it arguments, and return its exit sta-
tus. This is useful when defining a function whose name is the same as a shell
builtin, retaining the functionality of the builtin within the function. The cd
builtin is commonly redefined this way. The return status is false if shell-builtin
is not a shell builtin command.
cd [-L|-P] [dir]
Change the current directory to dir. The variable HOME is the default dir. The
variable CDPATH defines the search path for the directory containing dir. Alterna-
tive directory names in CDPATH are separated by a colon (:). A null directory name
in CDPATH is the same as the current directory, i.e., ‘‘.’’. If dir begins with a
slash (/), then CDPATH is not used. The -P option says to use the physical directory
structure instead of following symbolic links (see also the -P option to the set
builtin command); the -L option forces symbolic links to be followed. An argument of
- is equivalent to $OLDPWD. If a non-empty directory name from CDPATH is used, or if
- is the first argument, and the directory change is successful, the absolute path-
name of the new working directory is written to the standard output. The return
value is true if the directory was successfully changed; false otherwise.
caller [expr]
Returns the context of any active subroutine call (a shell function or a script exe-
cuted with the . or source builtins. Without expr, caller displays the line number
and source filename of the current subroutine call. If a non-negative integer is
supplied as expr, caller displays the line number, subroutine name, and source file
corresponding to that position in the current execution call stack. This extra
information may be used, for example, to print a stack trace. The current frame is
frame 0. The return value is 0 unless the shell is not executing a subroutine call
or expr does not correspond to a valid position in the call stack.
command [-pVv] command [arg ...]
Run command with args suppressing the normal shell function lookup. Only builtin com-
mands or commands found in the PATH are executed. If the -p option is given, the
search for command is performed using a default value for PATH that is guaranteed to
find all of the standard utilities. If either the -V or -v option is supplied, a
description of command is printed. The -v option causes a single word indicating the
command or file name used to invoke command to be displayed; the -V option produces a
more verbose description. If the -V or -v option is supplied, the exit status is 0
if command was found, and 1 if not. If neither option is supplied and an error
occurred or command cannot be found, the exit status is 127. Otherwise, the exit
status of the command builtin is the exit status of command.
compgen [option] [word]
Generate possible completion matches for word according to the options, which may be
any option accepted by the complete builtin with the exception of -p and -r, and
write the matches to the standard output. When using the -F or -C options, the vari-
ous shell variables set by the programmable completion facilities, while available,
will not have useful values.
The matches will be generated in the same way as if the programmable completion code
had generated them directly from a completion specification with the same flags. If
word is specified, only those completions matching word will be displayed.
The return value is true unless an invalid option is supplied, or no matches were
generated.
complete [-abcdefgjksuv] [-o comp-option] [-A action] [-G globpat] [-W wordlist] [-P prefix]
[-S suffix]
[-X filterpat] [-F function] [-C command] name [name ...]
complete -pr [name ...]
Specify how arguments to each name should be completed. If the -p option is sup-
plied, or if no options are supplied, existing completion specifications are printed
in a way that allows them to be reused as input. The -r option removes a completion
specification for each name, or, if no names are supplied, all completion specifica-
tions.
The process of applying these completion specifications when word completion is
attempted is described above under Programmable Completion.
Other options, if specified, have the following meanings. The arguments to the -G,
-W, and -X options (and, if necessary, the -P and -S options) should be quoted to
protect them from expansion before the complete builtin is invoked.
-o comp-option
The comp-option controls several aspects of the compspec’s behavior beyond
the simple generation of completions. comp-option may be one of:
bashdefault
Perform the rest of the default bash completions if the compspec gen-
erates no matches.
default Use readline’s default filename completion if the compspec generates
no matches.
dirnames
Perform directory name completion if the compspec generates no
matches.
filenames
Tell readline that the compspec generates filenames, so it can per-
form any filename-specific processing (like adding a slash to direc-
tory names or suppressing trailing spaces). Intended to be used with
shell functions.
nospace Tell readline not to append a space (the default) to words completed
at the end of the line.
plusdirs
After any matches defined by the compspec are generated, directory
name completion is attempted and any matches are added to the results
of the other actions.
-A action
The action may be one of the following to generate a list of possible comple-
tions:
alias Alias names. May also be specified as -a.
arrayvar
Array variable names.
binding Readline key binding names.
builtin Names of shell builtin commands. May also be specified as -b.
command Command names. May also be specified as -c.
directory
Directory names. May also be specified as -d.
disabled
Names of disabled shell builtins.
enabled Names of enabled shell builtins.
export Names of exported shell variables. May also be specified as -e.
file File names. May also be specified as -f.
function
Names of shell functions.
group Group names. May also be specified as -g.
helptopic
Help topics as accepted by the help builtin.
hostname
Hostnames, as taken from the file specified by the HOSTFILE shell
variable.
job Job names, if job control is active. May also be specified as -j.
keyword Shell reserved words. May also be specified as -k.
running Names of running jobs, if job control is active.
service Service names. May also be specified as -s.
setopt Valid arguments for the -o option to the set builtin.
shopt Shell option names as accepted by the shopt builtin.
signal Signal names.
stopped Names of stopped jobs, if job control is active.
user User names. May also be specified as -u.
variable
Names of all shell variables. May also be specified as -v.
-G globpat
The filename expansion pattern globpat is expanded to generate the possible
completions.
-W wordlist
The wordlist is split using the characters in the IFS special variable as
delimiters, and each resultant word is expanded. The possible completions
are the members of the resultant list which match the word being completed.
-C command
command is executed in a subshell environment, and its output is used as the
possible completions.
-F function
The shell function function is executed in the current shell environment.
When it finishes, the possible completions are retrieved from the value of
the COMPREPLY array variable.
-X filterpat
filterpat is a pattern as used for filename expansion. It is applied to the
list of possible completions generated by the preceding options and argu-
ments, and each completion matching filterpat is removed from the list. A
leading ! in filterpat negates the pattern; in this case, any completion not
matching filterpat is removed.
-P prefix
prefix is added at the beginning of each possible completion after all other
options have been applied.
-S suffix
suffix is appended to each possible completion after all other options have
been applied.
The return value is true unless an invalid option is supplied, an option other than
-p or -r is supplied without a name argument, an attempt is made to remove a comple-
tion specification for a name for which no specification exists, or an error occurs
adding a completion specification.
continue [n]
Resume the next iteration of the enclosing for, while, until, or select loop. If n
is specified, resume at the nth enclosing loop. n must be ≥ 1. If n is greater than
the number of enclosing loops, the last enclosing loop (the ‘‘top-level’’ loop) is
resumed. The return value is 0 unless the shell is not executing a loop when con-
tinue is executed.
declare [-afFirtx] [-p] [name[=value] ...]
typeset [-afFirtx] [-p] [name[=value] ...]
Declare variables and/or give them attributes. If no names are given then display
the values of variables. The -p option will display the attributes and values of
each name. When -p is used, additional options are ignored. The -F option inhibits
the display of function definitions; only the function name and attributes are
printed. If the extdebug shell option is enabled using shopt, the source file name
and line number where the function is defined are displayed as well. The -F option
implies -f. The following options can be used to restrict output to variables with
the specified attribute or to give variables attributes:
-a Each name is an array variable (see Arrays above).
-f Use function names only.
-i The variable is treated as an integer; arithmetic evaluation (see ARITHMETIC
EVALUATION ) is performed when the variable is assigned a value.
-r Make names readonly. These names cannot then be assigned values by subsequent
assignment statements or unset.
-t Give each name the trace attribute. Traced functions inherit the DEBUG and
RETURN traps from the calling shell. The trace attribute has no special mean-
ing for variables.
-x Mark names for export to subsequent commands via the environment.
Using ‘+’ instead of ‘-’ turns off the attribute instead, with the exception that +a
may not be used to destroy an array variable. When used in a function, makes each
name local, as with the local command. If a variable name is followed by =value, the
value of the variable is set to value. The return value is 0 unless an invalid
option is encountered, an attempt is made to define a function using ‘‘-f foo=bar’’,
an attempt is made to assign a value to a readonly variable, an attempt is made to
assign a value to an array variable without using the compound assignment syntax (see
Arrays above), one of the names is not a valid shell variable name, an attempt is
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -