bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why is not every variable initialized to its data type specific default


From: Tim Friske
Subject: Why is not every variable initialized to its data type specific default value upon declaration in Bash?
Date: Tue, 27 Nov 2012 11:03:02 +0100

Hi folks,

when I execute the following code in Bash version "GNU bash, version
4.1.10(4)-release (i686-pc-cygwin)", I get:

declare a
declare -p a
# Output: -bash: declare: a: not found
declare -i b
declare -p b
# Output: -bash: declare: b: not found
declare -a c
declare -p c
# Output: declare -a c='()'
declare -A d
declare -p d
# Output: declare -A d='()'

Arguably I think that the above variables should either be initialized
in all cases or in none of them. That would seem more consistent
rather than initializing only arrays upon declaration.

Cheers,
Tim
--
`~~~~°<
C92A E44E CC19 58E2 FA35 4048 2217 3C6E 0338 83FC



reply via email to

[Prev in Thread] Current Thread [Next in Thread]