Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-project
Navigation:
Lists: gentoo-project: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-project@g.o
From: Steve Long <slong@...>
Subject: Re: Re: Re: New developer: Ron Gemeinhardt (timebandit)
Date: Tue, 30 Sep 2008 07:50:39 +0100
Ron Gemeinhardt wrote:

> Steve Long wrote:
>> Nirbheek Chauhan wrote:
>>> On Fri, Sep 26, 2008 at 2:09 PM, Steve Long
>>> <slong@...> wrote:
>>>> Nirbheek Chauhan wrote:
>>>>> $(for ACRONYM in ${LinkedIn}; do echo -en "${ACRONYM},"; done; echo
>>>>> -ne '\b')
>>>>>
>>>> Now that *is* fail ;-)
>>> Crap! I forgot, \b only works for displaying in the terminal; doesn't
>>> actually "backspace" :(
>>>
>> Eh works well enough for display (not file as you mentioned) ... <snip>
> 
> Gentlemen, please...can we talk about me for a minute?
> Though entertaining, this byplay eats into my allotted fifteen minutes of
> fame. ;-)
>
LMAO.
 
> Besides, you really want something like:
>
Heh, you had to go there.. I think you'll fit right in ;-)
 
> echo "knowledge of $(unset last; for ACRONYM in ${LinkedIn[*]};
> do echo -n ${last:+,}$arg; last=$arg; done)."
> 
> But I wasn't recruited to be a ebuild dev (Calchan would add, "yet") so I
> won't point that out.
> 
That's good ;p as all that does is what:
(IFS=,; echo "Knowledge of: ${LinkedIn[*]}")
..does, only not as elegantly (tho I don't like the subshell) nor is it
actually correct; quite apart from the typo, it will split on any
whitespace, not array members (which can be _any_ string). If you want to
iterate over an array, use: for foo in "${array[@]}"

Another good one is: printf '%s\n' "${array[@]}"

NB: without quotes, there's no difference between ${array[@]} and
${array[*]}. They will both be treated as a string split into parameters
according to IFS (space, tab and newline by default; unset IFS only uses
space.) This is similar to: echo $foo   vs: echo "$foo"

Quotes around the * form gives a single string, with each array member
separated by the first char of IFS (space by default or if unset, use IFS=  
to get no separator.) Quotes around the @ form gives every member as a
separate parameter (which is what you pretty much always want, except for
display.)

> Thanks to all for the warm welcome!  I promise to do my best to moderate
> the forums in the capricious, arbitrary and inscrutable--err, I mean, fair
> and balanced--manner to which we're all accustomed.
> 
Glad to hear it, I've often thought the Forums should be more like Fox in
proselytising The Gentoo Way?.. *runs*




References:
New developer: Ron Gemeinhardt (timebandit)
-- Denis Dupeyron
Re: New developer: Ron Gemeinhardt (timebandit)
-- Nirbheek Chauhan
Re: New developer: Ron Gemeinhardt (timebandit)
-- Steve Long
Re: Re: New developer: Ron Gemeinhardt (timebandit)
-- Nirbheek Chauhan
Re: Re: New developer: Ron Gemeinhardt (timebandit)
-- Steve Long
Re: Re: Re: New developer: Ron Gemeinhardt (timebandit)
-- Ron Gemeinhardt
Navigation:
Lists: gentoo-project: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Re: Re: Re: New developer: Ron Gemeinhardt (timebandit)
Next by thread:
Re: New developer: Ron Gemeinhardt (timebandit)
Previous by date:
Re: Re: Re: New developer: Ron Gemeinhardt (timebandit)
Next by date:
New developer: Heath Caldwell (hncaldwell)


Updated Jun 17, 2009

Summary: Archive of the gentoo-project mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.