From 2c5d0f94f08527151267482f67f1c4964f0a75e1 Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Sun, 13 Sep 2009 23:43:45 -0400 Subject: More localized sourcing When we're sourcing a profile just to obtain a single variable, use the form: INTERFACE=$(. "$DIR/$profile"; echo "$INTERFACE") This makes it clearer in the source what we're expecting to obtain from the profile, and what we're ignoring. Also allows us to eliminate some more inclusive subshells. Signed-off-by: Jim Pryor --- src/netcfg-menu | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/netcfg-menu') diff --git a/src/netcfg-menu b/src/netcfg-menu index a054fe7..505a91b 100644 --- a/src/netcfg-menu +++ b/src/netcfg-menu @@ -11,11 +11,9 @@ i=0 while read prof; do # if there is a profile called "main", Use as default [[ "$prof" = "main" ]] && DEFAULT="main" - unset DESCRIPTION # JP: we can''t sandbox the sourced profiles, because we need to expose profiles[] - . "$PROFILE_DIR/$prof" profiles[$i]="$prof" let i++ - profiles[$i]="$DESCRIPTION" # JP: this will usually have spaces and must be quoted + profiles[$i]=$(. "$PROFILE_DIR/$prof"; echo "$DESCRIPTION") let i++ done < <(list_profiles | sort) # JP: re-use list_profiles instead of duplicating it; avoid subshell we'd get by piping it to the while read... -- cgit v1.2.3-24-g4f1b