Linux Commands: Declare variables and give them attributes
declare-Linux Command
declare
Declare variables and give them attributes.
SYNTAX
declare [-afFrxi] [-p] [name[=value]]
OPTIONS
-a Each name is an array variable.
-f Use function names only.
-F Inhibit the display of function definitions;
only the function name and attributes are printed.
(implies -f)
-i The variable is to be treated as an integer;
arithmetic evaluation is performed when the
variable is assigned a value.
-p Display the attributes and values of each name.
When `-p' is used, additional options are ignored.
-r Make names readonly. These names cannot then
be assigned values by subsequent assignment statements
or unset.
-x Mark each name for export to subsequent commands
via the environment.
If no names are given, then `declare' will display
the values of variables instead.
-
- Using `+' instead of `-' turns
off the attribute instead.
When used in a function, declare makes each name local,
as with the local command.
The typeset command is supplied for compatibility with the Korn
shell; however, it has been deprecated in favor of the declare
builtin command.
The return status is zero 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
, one of the names is not a valid shell variable 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'.
Other Linux Commands:
alias ,
break ,
builtin ,
cal ,
case ,
cat ,
cd ,
cfdisk ,
chgrp ,
chmod ,
chown ,
chroot ,
cksum ,
cmp ,
comm ,
command ,
continue ,
cp ,
cron ,
crontab ,
csplit ,
cut ,
date ,
dc ,
dd ,
declare ,
df ,
diff ,
diff3 ,
dir ,
dircolors ,
dirname ,
dirs ,
du ,
echo ,
egrep ,
enable ,
env ,
eval ,
exec ,
expand ,
export ,
expr ,
factor ,
false ,
fdformat ,
fdisk ,
fgrep ,
find ,
fmt ,
fold ,
for ,
fsck ,
function ,
getopts ,
hash ,
hashcharacter ,
head ,
history ,
hostname ,
id ,
if ,
import ,
install ,
join ,
kill ,
less ,
let ,
ln ,
local ,
locate ,
logname ,
logout ,
lpc ,
lpr ,
lprm ,
ls ,
m4 ,
man ,
mbadblocks ,
mkdir ,
mkfifo ,
mknod ,
more ,
mount ,
mtools ,
mv ,
nice ,
nl ,
nohup ,
passwd ,
paste ,
period ,
popd ,
pr ,
printf ,
ps ,
pushd ,
pwd ,
quota ,
quotacheck ,
quotactl ,
ram ,
rcp ,
read ,
readonly ,
return ,
rm ,
rmdir ,
rsync ,
sdiff ,
sed ,
select ,
seq ,
set ,
shift ,
shopt ,
shutdown ,
sleep ,
sort ,
split ,
su ,
sum ,
symlink ,
sync ,
tac ,
tail ,
tar ,
tee ,
test ,
time ,
times ,
top ,
touch ,
tr ,
traceroute ,
true ,
tsort ,
tty ,
type ,
ulimit ,
umask ,
uname ,
unexpand ,
uniq ,
units ,
unset ,
unshar ,
until ,
useradd ,
usermod ,
users ,
uuencode ,
watch ,
wc ,
whereis ,
which ,
while ,
who ,
xargs ,
yes ,
Live2Support.com :