help-bash
[Top][All Lists]
Advanced

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

[Help-bash] Why bash does not recoganize array type smartly?


From: Peng Yu
Subject: [Help-bash] Why bash does not recoganize array type smartly?
Date: Wed, 9 Mar 2016 22:16:16 -0600

Hi, Bash requires one explicitly declare associative array before it
can be used. It seems that this requirement may be too strictly given
no other types need to be declared first before being used.

Is there any rationale why bash is defined in this way. Wouldn't it
better to allow users define associative array just by using something
like `x=([a]=1 [b]=2)` without having to declare it?

x=([a]=1 [b]=2)
declare -A x
./main.sh: line 6: declare: x: cannot convert indexed to associative array

-- 
Regards,
Peng



reply via email to

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