El dom, 27-01-2013 a las 13:05 -0500, Mike Frysinger escribió:
> On Sunday 27 January 2013 12:47:28 Pacho Ramos wrote:
> > El dom, 27-01-2013 a las 15:00 +0100, Pacho Ramos escribió:
> > > Currently, when people uses DOC_CONTENTS variable to place their desired
> > > messages, they are automatically reformatted by "fmt" to get proper
> > > messages (for example, splitting long lines).
> > > 
> > > But, in some cases, may be useful to disable this behavior and respect
> > > strictly how DOC_CONTENTS was formatted, for example in that kind of
> > > messages telling people to run a command and, then, requiring a new line
> > > to be used. This can also be useful to append extra information to
> > > DOC_CONTENTS when, for example, additional info is needed when enabling
> > > a USE flag.
> > 
> > Well, after reading man echo I see all this is not needed, I simply need
> > to use echo -e to get it understand "\n" to create new lines
> 
> printf '%b' "${foo}"
> -mike

The problem is that it doesn't work so well. If I have the following at
src_prepare (for example):
src_prepare() {
        DOC_CONTENTS="You must create a symlink rom /etc/splash/tuxonice
to the theme you want tuxonice to use, e.g.: \n
                # ln -sfn /etc/splash/emergence /etc/splash/tuxonice \n"
...

and I handle ${DOC_CONTENTS} with quotes, it will end writing that tabs
also in generated file as the contents of the variable will be put
as-is. On the other hand, if I don't put it between quotes and, later,
pass "fmt", it will be formatted properly, without tabs and jumping to a
new line when \n is passed. In this way, echo will output a long line
with all the contents jumping to a new line when \n is found and, later,
fmt does the formatting.

But, if I use printf instead of echo:
1. If I put the variable with quotes it will be printed as-is (with
tabs).
2. If I drop the quotes, all spaces are dropped and end up with
something like:
Youmustcreateasymlinkfrom/etc/splash/tuxonicetothethemeyou

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to