diff options
author | Roy Marples <roy@marples.name> | 2007-11-29 11:23:06 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2007-11-29 11:23:06 +0000 |
commit | 82df7e4584282896a0618f14cca2dd3f3d23e8a2 (patch) | |
tree | 05a0c01d32adbbb2df8d833b97918454a3178a04 /sh | |
parent | 50161bef0e27ca235d876b888ae5abcafbec2ac7 (diff) |
Use shorthand for loops
Diffstat (limited to 'sh')
-rw-r--r-- | sh/functions.sh | 4 | ||||
-rwxr-xr-x | sh/net.sh | 12 |
2 files changed, 8 insertions, 8 deletions
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" @@ -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 |