summaryrefslogtreecommitdiffstats
path: root/scripts/netcfg-menu
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/netcfg-menu')
-rwxr-xr-xscripts/netcfg-menu12
1 files changed, 5 insertions, 7 deletions
diff --git a/scripts/netcfg-menu b/scripts/netcfg-menu
index ff57005..f7c9019 100755
--- a/scripts/netcfg-menu
+++ b/scripts/netcfg-menu
@@ -5,7 +5,7 @@
if [[ ! -x /usr/bin/dialog ]]; then
echo "Please install 'dialog' to use netcfg-menu"
exit 1
-fi
+fi
check_make_state_dir
@@ -18,10 +18,8 @@ i=0
while read prof; do
# if there is a profile called "main", Use as default
[[ "$prof" = "main" ]] && DEFAULT="main"
- profiles[$i]="$prof"
- let i++
- profiles[$i]=$(. "$PROFILE_DIR/$prof"; echo "$DESCRIPTION")
- let i++
+ profiles[i++]="$prof"
+ profiles[i++]=$(. "$PROFILE_DIR/$prof"; echo "$DESCRIPTION")
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...
if [[ ${#profiles} -eq 0 ]]; then
@@ -52,12 +50,12 @@ case $ret in
255) # timeout - use default
profile_up "$DEFAULT" # JP: use profile_up and catch $?
ret=$?
- if [[ $ret -eq 0 ]]; then echo "$DEFAULT" > "$STATE_DIR/menu"; fi
+ (( ret == 0 )) && echo "$DEFAULT" > "$STATE_DIR/menu"
;;
0) # User selection
profile_up "$(cat "$ANSWER")"
ret=$?
- if [[ $ret -eq 0 ]]; then mv "$ANSWER" "$STATE_DIR/menu"; fi
+ (( ret == 0 )) && mv "$ANSWER" "$STATE_DIR/menu"
;;
*) # Shouldnt happen
exit_err "Abnormal ret code from dialog: $ret"