sm-discuss AT lists.ibiblio.org
Subject: Public SourceMage Discussion List
List archive
- From: Ismael Luceno <ismael.luceno AT gmail.com>
- To: sm-discuss AT lists.ibiblio.org
- Subject: Re: [SM-Discuss] Spell branches
- Date: Tue, 13 Sep 2011 12:45:04 -0300
El Tue, 13 Sep 2011 16:52:43 +0900
flux <flux AT sourcemage.org> escribió:
> Ismael Luceno (ismael.luceno AT gmail.com) wrote [11.09.13 16:47]:
> > El Tue, 13 Sep 2011 08:26:09 +0900
> > flux <flux AT sourcemage.org> escribió:
> > <...>
> > > A slightly improved version of the code is as follows:
> > >
> > > function select_branch() {
> > > local spell="$1" tmp &&
> > > shift &&
> > >
> > > if [[ "$#" > 1 ]]; then
> > > config_query_list "$spell"_BRANCH \
> > > "Select one of the available branches:" "$@"
> > > else
> > > eval "$spell"_BRANCH=\""$spell"\"
> > > fi &&
> > >
> > > eval tmp=\"\$"$spell"_BRANCH\" &&
> > >
> > > if [[ "$tmp" != "$spell" && "${tmp/-*}" = "scm" ]]; then
> > > config_query "$spell"_SCM_AUTOUPDATE \
> > > 'Update on every system update?' n
> > > fi
> > > }
> > >
> > > This is more "correct" in that a spell named scm-foo wouldn't
> > > erroneously trigger the second if block to succeed. It's also a
> > > bit more readable in how tmp gets set (and uses the "$spell"
> > > variable instead of $1, so the value is more readable as well).
> >
> > $1 != $spell, 3rd line.
>
> What "3rd line"? The 3rd line is "shift &&". At any rate, the second
> line of "local spell="$1" tmp &&" sets spell=$1, and $spell is never
> modified again, either in your original or my modifications. Thus,
> your statement makes no sense at all.
>
I mean that, past that line, $1 isn't $spell. E.g.:
select_branch SPELL scm
Then $spell would be "SPELL" and $1 "scm". So this version behaves
quite differently.
Attachment:
signature.asc
Description: PGP signature
-
[SM-Discuss] Spell branches,
Ismael Luceno, 09/11/2011
- Re: [SM-Discuss] Spell branches, David Kowis, 09/12/2011
-
Re: [SM-Discuss] Spell branches,
Bor Kraljič, 09/12/2011
-
Re: [SM-Discuss] Spell branches,
flux, 09/12/2011
- Re: [SM-Discuss] Spell branches, Bor Kraljič, 09/13/2011
-
Re: [SM-Discuss] Spell branches,
Ismael Luceno, 09/13/2011
- Re: [SM-Discuss] Spell branches, Bor Kraljič, 09/13/2011
-
Re: [SM-Discuss] Spell branches,
flux, 09/12/2011
-
Re: [SM-Discuss] Spell branches,
flux, 09/12/2011
-
Re: [SM-Discuss] Spell branches,
Ismael Luceno, 09/13/2011
-
Re: [SM-Discuss] Spell branches,
flux, 09/13/2011
-
Re: [SM-Discuss] Spell branches,
Ismael Luceno, 09/13/2011
-
Re: [SM-Discuss] Spell branches,
flux, 09/13/2011
- Re: [SM-Discuss] Spell branches, Ismael Luceno, 09/13/2011
-
Re: [SM-Discuss] Spell branches,
flux, 09/13/2011
-
Re: [SM-Discuss] Spell branches,
Ismael Luceno, 09/13/2011
-
Re: [SM-Discuss] Spell branches,
flux, 09/13/2011
- Re: [SM-Discuss] Spell branches, Bor Kraljič, 09/13/2011
-
Re: [SM-Discuss] Spell branches,
Ismael Luceno, 09/13/2011
-
Re: [SM-Discuss] Spell branches,
Bor Kraljič, 09/16/2011
-
Re: [SM-Discuss] Spell branches,
Andraž 'ruskie' Levstik, 09/16/2011
-
Re: [SM-Discuss] Spell branches,
Ismael Luceno, 09/19/2011
- Re: [SM-Discuss] Spell branches, Bor Kraljič, 09/20/2011
-
Re: [SM-Discuss] Spell branches,
Ismael Luceno, 09/19/2011
-
Re: [SM-Discuss] Spell branches,
Andraž 'ruskie' Levstik, 09/16/2011
Archive powered by MHonArc 2.6.24.