From patchwork Mon May 20 09:05:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 7795 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4VjWsl4Q1Wz3wxV for ; Mon, 20 May 2024 09:07:07 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4VjWsG0rVhz5nP; Mon, 20 May 2024 09:06:42 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4VjWs95VPKz3370; Mon, 20 May 2024 09:06:37 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4VjWs53bs0z336Z for ; Mon, 20 May 2024 09:06:33 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4VjWs50sBDz5j3; Mon, 20 May 2024 09:06:33 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1716195993; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yNYZXEcIvro0vPwGX/GzaGbTkXh1bp2gxD3bnUWKcjs=; b=HbGYhikmqBRfNEzD4PwVlani3j2GkWlEXvLZiKO4FvNbFtHuPFKQmeRJC6BLBVWyf+GzLF g3cYXngRyMcMDLDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1716195993; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yNYZXEcIvro0vPwGX/GzaGbTkXh1bp2gxD3bnUWKcjs=; b=afCf8POJ44SK8qZp2txF0e//T0hy7c/msidZTiCUU6vmsA1HXMzjuP9+UtHpdi/6vhQEj1 qtYABPGlyVfC1YCKdSCxT5tBDB/vqpmUfyZ7k7RbZc646j72pWsz+xs0wuRNUtQQRXlJxs NMhRCtJuBg8K1va+5bhPJzmt7jXhIHBRSnmMaQ+ZkM/FBCBhg5uzOO6xK+wLNSe6G1hFYp G4toJ7WM6HFeQCSS4zz5xA5y4rlX2zLAAGaVTF3siuMpvjoP2uwumrhcE/t7fqR3oSFpfX r1sG09m8dATNf6VzdmMHOHx7alEyf2JrFjeDWCwCIZ4csCmisKmmLiEQgNSyew== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [PATCH 09/21] tests/lib.sh: Use namref to access an array Date: Mon, 20 May 2024 11:05:59 +0200 Message-Id: <20240520090611.10406-10-jonatan.schlag@ipfire.org> In-Reply-To: <20240520090611.10406-1-jonatan.schlag@ipfire.org> References: <20240520090611.10406-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: 6VU6GFXR5F3SCBRHK25V2LM3EQIN6K3Z X-Message-ID-Hash: 6VU6GFXR5F3SCBRHK25V2LM3EQIN6K3Z X-MailFrom: jonatan.schlag@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: ! does not work here. So the solution here is: https://unix.stackexchange.com/questions/60584/how-to-use-a-variable-as-part-of-an-array-name/60585#60585 Signed-off-by: Jonatan Schlag --- tests/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib.sh b/tests/lib.sh index 006862da6..ad7c12cb0 100644 --- a/tests/lib.sh +++ b/tests/lib.sh @@ -28,7 +28,7 @@ var_has_value() { } test_that_key_in_arry_has_value() { - local array="${!1}" + local -n array="${1}" local arrayname="${1}" local key="${2}" local value="${3}"