[LEDE-DEV] [patch master 06/15] redirect matters, the 2>&1 has to be last.

Lars Kruse lists at sumpfralle.de
Fri Sep 30 15:17:45 PDT 2016


Hi,


Am Fri, 30 Sep 2016 22:02:20 +0200
schrieb Jan-Tarek Butt <tarek at ring0.de>:

> ---
>  scripts/make-ipkg-dir.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/make-ipkg-dir.sh b/scripts/make-ipkg-dir.sh
> index 529e430..9e38df5 100755
> --- a/scripts/make-ipkg-dir.sh
> +++ b/scripts/make-ipkg-dir.sh
> @@ -9,9 +9,9 @@ WD=$(pwd)
>  
>  mkdir -p "$TARGET/CONTROL"
>  grep '^[^(Version|Architecture)]' "$CONTROL" > "$TARGET/CONTROL/control"
> -grep '^Maintainer' "$CONTROL" 2>&1 >/dev/null || \
> +grep '^Maintainer' "$CONTROL" > /dev/null 2>&1 || \
>          echo "Maintainer: LEDE Community <lede-dev at lists.infradead.org>" >>
> "$TARGET/CONTROL/control" -grep '^Source' "$CONTROL" 2>&1 >/dev/null || {
> +grep '^Source' "$CONTROL" > /dev/null 2>&1 || {
>          pkgbase=$(echo "$WD" | sed -e "s|^$TOPDIR/||g")
>          [ "$pkgbase" = "$WD" ] && src="N/A" || src="$BASE/$pkgbase"
>          echo "Source: $src" >> "$TARGET/CONTROL/control"

I think, the original author intended the following:
  grep -q '^Maintainer' "$CONTROL" || \

This should be easier to read and does not hide errors like "$CONTROL does not
exist".


btw: In the lines above, the following statement does not work in the way it
looks like, or?
  grep '^[^(Version|Architecture)]' "$CONTROL"
This "looks" like it schould remove all lines starting with "Version" or
"Architecture". But I think, in fact it removes all lines starting with any of
the characters within the square brackets above (e.g. "V", "e", "r", ...).
The following line should implement the intention of the author:
  grep -v "^\(Version\|Architecture\)"


Lars



More information about the Lede-dev mailing list