[LEDE-DEV] [patch master 13/15] To read lines rather than words, pipe/redirect to a 'while read' loop
Lars Kruse
lists at sumpfralle.de
Fri Sep 30 15:44:36 PDT 2016
Hi,
Am Fri, 30 Sep 2016 22:02:27 +0200
schrieb Jan-Tarek Butt <tarek at ring0.de>:
> ---
> 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,')"
Is this really doing what it looks like?
... < "$(command)"
This should try to read from a file named like the output of "command" - and
not the lines of command's output.
I guess, the following approach should do the right thing:
grep CONFIG_PACKAGE tmp/.packagedeps | grep -E > "[ /]$pkg\$" | sed -e 's,package-$(\(CONFIG_PACKAGE_.*\)).*,\1,') | while IFS= read -r conf; do
...
done
btw: "IFS=" can be omitted here, since there is only a single target variable, or?
Cheers,
Lars
More information about the Lede-dev
mailing list