Use shorthand for loops

This commit is contained in:
Roy Marples 2007-11-29 11:23:06 +00:00
parent 50161bef0e
commit 82df7e4584
8 changed files with 22 additions and 22 deletions

View File

@ -989,7 +989,7 @@
# eerror "You need to enable IP Policy Routing (CONFIG_IP_MULTIPLE_TABLES)"
# eerror "in your kernel to use ip rules"
# else
# for x in "$@"; do
# for x; do
# ebegin "${x}"
# ip rule add ${x} dev "${IFACE}"
# eend $?

View File

@ -45,7 +45,7 @@ load_modules() {
eindent
local x= cnt=0
for x in "$@"; do
for x; do
set -- ${x}
ebegin "Loading module $1"
eval modprobe -q "$@"

View File

@ -30,7 +30,7 @@ need_portmap() {
local mnt opts ret IFS="
"
set -- $(fstabinfo --fstype nfs,nfs4)
for mnt in "$@"; do
for mnt; do
case ,$(fstabinfo --options "${mnt}"), in
*,noauto,*|*,nolock,*);;
*) return 0;;

View File

@ -376,7 +376,7 @@ iwconfig_scan() {
eval set -- $(_flatten_array "blacklist_aps_${IFVAR}")
[ $# = 0 ] && eval set -- $(_flatten_array "blacklist_aps")
for x in "$@"; do
for x; do
if [ "${x}" = "${s}" ] ; then
ewarn "${s} has been blacklisted - not connecting"
unset SSID_${i} MAC_${i} CHAN_${i} QUALITY_${i} CAPS_${i}
@ -395,7 +395,7 @@ iwconfig_force_preferred() {
ewarn "Trying to force preferred in case they are hidden"
local ssid=
for ssid in "$@"; do
for ssid; do
local found_AP=false i=0 e=
while [ ${i} -le ${APS:--1} ] ; do
eval e=\$SSID_${i}
@ -421,7 +421,7 @@ iwconfig_connect_preferred() {
[ $# = 0 ] && return 1
local ssid= i=0 mode= mac= caps= freq= chan=
for ssid in "$@"; do
for ssid; do
while [ ${i} -le ${APS} ] ; do
eval e=\$SSID_${i}
if [ "${e}" = "${ssid}" ] ; then
@ -453,7 +453,7 @@ iwconfig_connect_not_preferred() {
eval set -- $(_flatten_array "preferred_aps_${IFVAR}")
[ $# = 0 ] && eval set -- $(_flatten_array "preferred_aps")
pref=false
for ssid in "$@"; do
for ssid; do
if [ "${e}" = "${ssid}" ] ; then
pref=true
break

View File

@ -112,7 +112,7 @@ bridge_post_stop() {
# Work out if we're added to a bridge for removal or not
eval set -- $(brctl show 2>/dev/null | sed -e "s/'/'\\\\''/g" -e "s/$/'/g" -e "s/^/'/g")
local line=
for line in "$@"; do
for line; do
set -- ${line}
if [ "$3" = "${IFACE}" ]; then
iface=$1

View File

@ -122,7 +122,7 @@ iwconfig_get_wep_key() {
else
set -- ${key}
local x= e=false
for x in "$@"; do
for x; do
if [ "${x}" = "enc" ]; then
e=true
break
@ -373,7 +373,7 @@ iwconfig_scan() {
APS=-1
eval set -- ${scan}
for line in "$@"; do
for line; do
case "${line}" in
*Address:*)
APS=$((${APS} + 1))
@ -499,7 +499,7 @@ iwconfig_scan() {
eval set -- $(_flatten_array "blacklist_aps_${IFVAR}")
[ $# = 0 ] && eval set -- $(_flatten_array "blacklist_aps")
for x in "$@"; do
for x; do
if [ "${x}" = "${s}" ]; then
ewarn "${s} has been blacklisted - not connecting"
unset SSID_${i} MAC_${i} CHAN_${i} QUALITY_${i} ENC_${i}
@ -516,7 +516,7 @@ iwconfig_force_preferred() {
[ $# = 0 ] && return 1
ewarn "Trying to force preferred in case they are hidden"
for ssid in "$@"; do
for ssid; do
local found_AP=false i=0 e=
while [ ${i} -le ${APS} ]; do
eval e=\$SSID_${i}
@ -541,7 +541,7 @@ iwconfig_connect_preferred() {
eval set -- $(_flatten_array "preferred_aps_${IFVAR}")
[ $# = 0 ] && eval set -- $(_flatten_array "preferred_aps")
for ssid in "$@"; do
for ssid; do
unset IFS
i=0
while [ ${i} -le ${APS} ]; do
@ -571,7 +571,7 @@ iwconfig_connect_not_preferred() {
if [ -n "${e}" ]; then
eval set -- $(_flatten_array "preferred_aps_${IFVAR}")
[ $# = 0 ] && eval set -- $(_flatten_array "preferred_aps")
for ssid in "$@"; do
for ssid; do
if [ "${e}" = "${ssid}" ]; then
pref=true
break

View File

@ -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"

View File

@ -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