|
Assigns an
attributes to a variable #( with option but no variable names
as arguments, the command lists all shell variables that have
the indicated attributes set.)
Options:
-a declares
a variable as an array
-f declares
a variable to be a function name
-i declares
a variable to be type integer
-r makes
a variable readonly; also readonly
-x
exports a variable (makes it global-all shells); also export
Examples:
|
[bash]$
declare -x person=chris
# makes it global
[bash]$
declare +x person=chris # removes an attribute from a
variable
[bash]$
declare -r personal=chris # set the variable readonly
(can not be undone) |
|