1 |
El dom, 27-01-2013 a las 13:05 -0500, Mike Frysinger escribió: |
2 |
> On Sunday 27 January 2013 12:47:28 Pacho Ramos wrote: |
3 |
> > El dom, 27-01-2013 a las 15:00 +0100, Pacho Ramos escribió: |
4 |
> > > Currently, when people uses DOC_CONTENTS variable to place their desired |
5 |
> > > messages, they are automatically reformatted by "fmt" to get proper |
6 |
> > > messages (for example, splitting long lines). |
7 |
> > > |
8 |
> > > But, in some cases, may be useful to disable this behavior and respect |
9 |
> > > strictly how DOC_CONTENTS was formatted, for example in that kind of |
10 |
> > > messages telling people to run a command and, then, requiring a new line |
11 |
> > > to be used. This can also be useful to append extra information to |
12 |
> > > DOC_CONTENTS when, for example, additional info is needed when enabling |
13 |
> > > a USE flag. |
14 |
> > |
15 |
> > Well, after reading man echo I see all this is not needed, I simply need |
16 |
> > to use echo -e to get it understand "\n" to create new lines |
17 |
> |
18 |
> printf '%b' "${foo}" |
19 |
> -mike |
20 |
|
21 |
The problem is that it doesn't work so well. If I have the following at |
22 |
src_prepare (for example): |
23 |
src_prepare() { |
24 |
DOC_CONTENTS="You must create a symlink rom /etc/splash/tuxonice |
25 |
to the theme you want tuxonice to use, e.g.: \n |
26 |
# ln -sfn /etc/splash/emergence /etc/splash/tuxonice \n" |
27 |
... |
28 |
|
29 |
and I handle ${DOC_CONTENTS} with quotes, it will end writing that tabs |
30 |
also in generated file as the contents of the variable will be put |
31 |
as-is. On the other hand, if I don't put it between quotes and, later, |
32 |
pass "fmt", it will be formatted properly, without tabs and jumping to a |
33 |
new line when \n is passed. In this way, echo will output a long line |
34 |
with all the contents jumping to a new line when \n is found and, later, |
35 |
fmt does the formatting. |
36 |
|
37 |
But, if I use printf instead of echo: |
38 |
1. If I put the variable with quotes it will be printed as-is (with |
39 |
tabs). |
40 |
2. If I drop the quotes, all spaces are dropped and end up with |
41 |
something like: |
42 |
Youmustcreateasymlinkfrom/etc/splash/tuxonicetothethemeyou |