From 653ec7d08672a4719adb14cc287ddc4675255ddd Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 5 May 2023 17:40:03 +0200 Subject: [PATCH] modalias.prov: use "local" builtin rather than "declare" While (in this case) their effect is the same, many more people know that "local" makes variables function-local, than that "declare" in bash does the same. I didn't know. Signed-off-by: Denys Vlasenko --- modalias.prov | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modalias.prov b/modalias.prov index 96bfc64..8b3332b 100755 --- a/modalias.prov +++ b/modalias.prov @@ -34,7 +34,7 @@ command -v sed >/dev/null || exit 1 command -v sort >/dev/null || exit 1 print_modaliases() { - declare class=$1 variants=$2 pos=$3 + local class="$1" variants="$2" pos="$3" if [ -n "$variants" ]; then echo "${class:0:pos}[$variants]${class:pos+1}" else @@ -43,7 +43,7 @@ print_modaliases() { } combine_modaliases() { - declare tag class variants="" pos="" n + local tag class variants="" pos="" n # Due to set -e, we can exit with exitcode 1 on read EOF # and this makes our caller think we failed. "|| return 0" prevents this: