[LEDE-DEV] [patch master 13/15] To read lines rather than words, pipe/redirect to a 'while read' loop

Jan-Tarek Butt tarek at ring0.de
Fri Sep 30 13:02:27 PDT 2016


---
 scripts/deptest.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/deptest.sh b/scripts/deptest.sh
index 8c859ef..0b0e7a9 100755
--- a/scripts/deptest.sh
+++ b/scripts/deptest.sh
@@ -86,9 +86,9 @@ test_package() # $1=pkgname
 	[ -n "$pkg" -a -z "$(echo "$pkg" | grep -e '/')" -a "$pkg" != "." -a "$pkg" != ".." ] || \
 		die "Package name \"$pkg\" contains illegal characters"
 	local SELECTED=
-	for conf in $(grep CONFIG_PACKAGE tmp/.packagedeps | grep -E "[ /]$pkg\$" | sed -e 's,package-$(\(CONFIG_PACKAGE_.*\)).*,\1,'); do
+	while IFS= read -r conf; do
 		grep "$conf=" .config > /dev/null && SELECTED=1 && break
-	done
+	done < "$(grep CONFIG_PACKAGE tmp/.packagedeps | grep -E "[ /]$pkg\$" | sed -e 's,package-$(\(CONFIG_PACKAGE_.*\)).*,\1,')"
 	local STAMP_SUCCESS="$STAMP_DIR_SUCCESS/$pkg"
 	local STAMP_FAILED="$STAMP_DIR_FAILED/$pkg"
 	local STAMP_BLACKLIST="$STAMP_DIR_BLACKLIST/$pkg"
@@ -200,9 +200,9 @@ bootstrap_native_make()
 
 if [ -z "$packages" ]; then
 	# iterate over all packages
-	for pkg in $(cat tmp/.packagedeps  | grep CONFIG_PACKAGE | grep -v curdir | sed -e 's,.*[/=]\s*,,' | sort -u); do
+	while IFS= read -r pkg; do
 		test_package "$pkg"
-	done
+	done < "$(cat tmp/.packagedeps  | grep CONFIG_PACKAGE | grep -v curdir | sed -e 's,.*[/=]\s*,,' | sort -u)"
 else
 	# only check the specified packages
 	for pkg in $packages; do
-- 
2.10.0




More information about the Lede-dev mailing list