From 82df7e4584282896a0618f14cca2dd3f3d23e8a2 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Thu, 29 Nov 2007 11:23:06 +0000 Subject: Use shorthand for loops --- sh/functions.sh | 4 ++-- sh/net.sh | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'sh') diff --git a/sh/functions.sh b/sh/functions.sh index 0a1ba817..fd67cb2b 100644 --- a/sh/functions.sh +++ b/sh/functions.sh @@ -78,7 +78,7 @@ is_older_than() { local x= ref="$1" shift - for x in "$@"; do + for x; do [ -e "${x}" ] || continue # We need to check the mtime if it's a directory too as the # contents may have changed. @@ -163,7 +163,7 @@ fi export PATH="/lib/rc/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin$(_sanitize_path "${PATH}")" unset _sanitize_path -for arg in "$@"; do +for arg; do case "${arg}" in --nocolor|--nocolour|-C) export RC_NOCOLOR="yes" diff --git a/sh/net.sh b/sh/net.sh index 992eacf9..31e2bc84 100755 --- a/sh/net.sh +++ b/sh/net.sh @@ -83,7 +83,7 @@ _get_array() { case "$(declare -p "$1" 2>/dev/null)" in "declare -a "*) eval "set -- \"\${$1[@]}\"" - for _a in "$@"; do + for _a; do printf "%s\n" "${_a}" done return 0 @@ -103,7 +103,7 @@ _flatten_array() { case "$(declare -p "$1" 2>/dev/null)" in "declare -a "*) eval "set -- \"\${$1[@]}\"" - for x in "$@"; do + for x; do printf "'%s' " "$(printf "$x" | sed "s:':'\\\'':g")" done return 0 @@ -165,7 +165,7 @@ _configure_variables() { for var in ${_config_vars}; do local v= - for t in "$@"; do + for t; do eval v=\$${var}_${t} if [ -n "${v}" ]; then eval ${var}_${IFVAR}=\$${var}_${t} @@ -204,7 +204,7 @@ _gen_module_list() { before() { local mod=${MODULE} local MODULE= - for MODULE in "$@"; do + for MODULE; do after "${mod}" done } @@ -315,7 +315,7 @@ _load_modules() { eval set -- \$module_${i}_program if [ -n "$1" ]; then x= - for x in "$@"; do + for x; do [ -x "${x}" ] && break done [ -x "${x}" ] || continue @@ -327,7 +327,7 @@ _load_modules() { fi if [ -n "$1" ]; then x= - for x in "$@"; do + for x; do [ -x "${x}" ] && break done [ -x "${x}" ] || continue -- cgit v1.2.3