Re: [Tails-dev] Scripts for importing Transifex translations…

Üzenet törlése

Válasz az üzenetre
Szerző: winterfairy
Dátum:  
Címzett: tails-dev
Tárgy: Re: [Tails-dev] Scripts for importing Transifex translations, take two, please review
intrigeri wrote:
> winterfairy wrote:
>> See my tails repository, branch "import-translations-extern".
>> [...]
>
> Here's an initial code review.
>
> Instead of:
>
> SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
>
> .. I would write the slightly nicer (to my eye):
>
> SCRIPT_DIR=$(readlink -f $(dirname "$0"))


Done in the same branch :)

> Regarding:
>
> > -       $GIT_IN_TOR_TRANSLATION_DIR fetch origin
> > +       eval "$GIT_IN_TOR_TRANSLATION_DIR fetch origin"

>
> ... why the need to use "eval" here?
>
> Same for:
>
> > +       eval "$AFTER_IMPORT"

>
> ... where:
>
>       $AFTER_IMPORT

>
> would work, right?


The reasons for the eval uses is because that is the proper way to execute
a shell command stored in a variable [1], which is what we do in these
cases.

For $AFTER_IMPORT in liveusb-creator, the command would otherwise fail
with (since && is not interpreted correctly):
> make: "s,\.new\$,,": No such file or directory
> make: *** No rule to make target `"s,\.new\$,,"'. Stop.


Same for the git commands, the double-quotes in
$GIT_IN_TOR_TRANSLATION_DIR are not interpreted correctly unless run in
eval.

[1] http://fvue.nl/wiki/Bash:_Why_use_eval_with_variable_expansion%3F