# This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # implicit and explicit variable type conversions declare -A A=(x x) declare -p A f() { declare -g A=([1]=1); } f declare -p A unset -f f # error to convert associative to indexed f() { declare -ga A=([1]=1); } f # error to convert associative to indexed declare -a A=([1]=1) declare -p A unset -v A declare -a A=(x x) declare -p A # error to convert indexed to associative f() { declare -gA A=([1]=1); } f declare -p A # error to convert indexed to associative declare -A A=([1]=1) declare -p A # can't read into an associative array unset -v A declare -A A read -a A