[pacman-dev,v2,3/3] libmakepkg/util: use parameter transformation when checking variable type

Message ID 20180619202635.24426-3-eschwartz@archlinux.org
State Accepted, archived
Headers show
Series [pacman-dev,v2,1/3] configure: bump the minimum version of bash to 4.4 | expand

Commit Message

Eli Schwartz June 19, 2018, 8:26 p.m. UTC
Now that we require bash 4.4 this is "more correct" than analyzing the
output of declare -p to see if it compares favorably with -a.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
---
 scripts/libmakepkg/util/util.sh.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/scripts/libmakepkg/util/util.sh.in b/scripts/libmakepkg/util/util.sh.in
index e1ca5cb7..0fb89186 100644
--- a/scripts/libmakepkg/util/util.sh.in
+++ b/scripts/libmakepkg/util/util.sh.in
@@ -42,7 +42,7 @@  is_array() {
 	local v=$1
 	local ret=1
 
-	if [[ $(declare -p "$v") == declare\ -*([[:alnum:]])a*([[:alnum:]])\ * ]]; then
+	if [[ ${!v@a} = *a* ]]; then
 		ret=0
 	fi