Use shorthand for loops
This commit is contained in:
		| @@ -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" | ||||
|   | ||||
							
								
								
									
										12
									
								
								sh/net.sh
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user