Bash and declare
Christopher Browne
cbbrowne-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Wed Mar 29 15:49:38 UTC 2006
On 3/29/06, Neil Watson <tlug-neil-8agRmHhQ+n2CxnSzwYWP7Q at public.gmane.org> wrote:
> I bought Ken's book on Bash scripting. In it he talks about using
> 'declare' to initialize variables. In Perl 'my' is used like declare
> but, more specifically for variable scope. What is the purpose of
> declare?
It is used to indicate variable attributes.
declare -a arr
indicates that arr is an array
declare -i ival
indicates that ival stores integers, as opposed to strings/floats
declare -r rval
indicates that rval is now read-only
There are several other declaration options; see the man page :-).
--
http://www3.sympatico.ca/cbbrowne/linux.html
"The true measure of a man is how he treats someone who can do him
absolutely no good." -- Samuel Johnson, lexicographer (1709-1784)
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list