|
发表于 2005-5-23 16:08:43
|
显示全部楼层
下面是引用中国之屎于2005-05-23 13:47发表的:
richard@darling ~ $ man declare
Cannot open the message catalog "man" for locale "zh_CN"
(NLSPATH="<none>")
No manual entry for declare
.......
export和declare是bash内置的,没有独立的manual.
在bash manual的"Shell Builtin Commands"一章中,有declare的比较详细的解释.
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. The -F option implies -f. The follow-
ing 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 evalu-
ation (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 trap from the calling shell. The
trace attribute has no special meaning 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 vari-
able. When used in a function, makes each name local, as with
the local command. 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 vari-
able name, an attempt is made to turn off readonly status for a
readonly variable, an attempt is made to turn off array status
for an array variable, or an attempt is made to display a non-
existent function with -f. |
|