Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: Ulrich Mueller <ulm@g.o>
Cc: gentoo-dev@l.g.o, Pacho Ramos <pacho@g.o>
Subject: Re: [gentoo-dev] [PATCH] readme.gentoo-r1.eclass: Do not inherit eutils.
Date: Sat, 19 Dec 2015 18:35:26
Message-Id: 20151219193457.254ed534.mgorny@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH] readme.gentoo-r1.eclass: Do not inherit eutils. by Ulrich Mueller
1 On Sat, 19 Dec 2015 19:24:17 +0100
2 Ulrich Mueller <ulm@g.o> wrote:
3
4 > >>>>> On Sat, 19 Dec 2015, Michał Górny wrote:
5 >
6 > >> + set -f # disable filename expansion in echo arguments
7 > >> echo -e ${DOC_CONTENTS} | fold -s -w 70 \
8 > >> | sed 's/[[:space:]]*$//' > "${T}"/README.gentoo
9 >
10 > > Maybe I'm missing something but is there any reason not to quote
11 > > "${DOC_CONTENTS}" instead of working around the results of not
12 > > quoting it?
13 >
14 > IIUC the intention of not quoting it is to normalise whitespace,
15 > especially embedded newlines. Unfortunately, I don't see a good way to
16 > do this differently. Adding another processing step after echo -e is
17 > too late, because newlines expanded from \n must be kept.
18
19 read -d '' -r -a DOC_CONTENTS <<<"${DOC_CONTENTS}"
20
21 This performs word splitting into an array. Then you can do:
22
23 echo -e "${DOC_CONTENTS[*]}" | ...
24
25 --
26 Best regards,
27 Michał Górny
28 <http://dev.gentoo.org/~mgorny/>

Replies