1 |
Brian Harring wrote: |
2 |
|
3 |
>On Wed, Jan 11, 2006 at 10:15:00AM +0100, Johannes Fahrenkrug wrote: |
4 |
> |
5 |
> |
6 |
>>if [[ -n $PORTAGE_NICENESS ]] && ! [[ -z $WE_ARE_NICED ]]; then |
7 |
>> |
8 |
>> |
9 |
> |
10 |
>Haven't looked at the patch yet, but a bit of bash fu for ya- |
11 |
> |
12 |
>[[ -n $VAR ]] == ! [[ -z $VAR ]] |
13 |
> |
14 |
>-z is zero length or unset, -n is length >= 1 (thus must be set). |
15 |
> |
16 |
> |
17 |
Exactly! |
18 |
This code ... |
19 |
|
20 |
If [[ -n $VAR ]] == ! [[ -z $VAR ]] (which it is) then |
21 |
export WE_ARE_NICED=1 |
22 |
exec nice -n "$PORTAGE_NICENESS" "$0" "$@" |
23 |
fi |
24 |
|
25 |
...has the purpose to execute the current script again with |
26 |
nice if PORTAGE_NICENESS is set and WE_ARE_NICED is not set (to avoid an |
27 |
infinite loop). |
28 |
Right? |
29 |
|
30 |
If... |
31 |
|
32 |
if [[ -n $PORTAGE_NICENESS ]] && ! [[ -z $WE_ARE_NICED ]]; then |
33 |
|
34 |
...is the same as... |
35 |
|
36 |
if [[ -n $PORTAGE_NICENESS ]] && [[ -n $WE_ARE_NICED ]]; then |
37 |
|
38 |
...then that would mean that the condition is only met when both |
39 |
PORTAGE_NICENESS |
40 |
and WE_ARE_NICED are set. But WE_ARE_NICED is only set inside the |
41 |
if-body. So |
42 |
I think the condition should read |
43 |
if [[ -n $PORTAGE_NICENESS ]] && [[ -z $WE_ARE_NICED ]]; then |
44 |
meaning the condition is only met when PORTAGE_NICENESS is set and |
45 |
WE_ARE_NICED is NOT set. |
46 |
|
47 |
Maybe I'm completely wrong here, but I think that's the only way the |
48 |
condition makes sense. |
49 |
Please enlighten me if I'm wrong :) |
50 |
|
51 |
- Johannes. |
52 |
|
53 |
|
54 |
-- |
55 |
gentoo-portage-dev@g.o mailing list |