Gentoo Archives: gentoo-project

From: Steve Long <slong@××××××××××××××××××.uk>
To: gentoo-project@l.g.o
Subject: [gentoo-project] Re: Re: New developer: Ron Gemeinhardt (timebandit)
Date: Mon, 29 Sep 2008 20:17:15
Message-Id: gbrd3h$1a5$
In Reply to: Re: [gentoo-project] Re: New developer: Ron Gemeinhardt (timebandit) by Nirbheek Chauhan
Nirbheek Chauhan wrote:

> On Fri, Sep 26, 2008 at 2:09 PM, Steve Long <slong@××××××××××××××××××.uk> > 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) it's just you should know about "${arr[*]}" vs "${arr[@]}" Both are designed to help with scriptin; the first with exactly this issue, and the latter with handling array parameters correctly, analagous to "$@" and "$*". Check out for more nice stuff you can do with array expansions (as well as scalars.)
>> >>> So, where's my free review? ;p >>> >> isArr LinkedIn || LinkedIn=($LinkedIn) >> oIFS=$IFS >> IFS=, # This line and next are what you should >> echo "${LinkedIn[*]}" # be aware of. cf: /msg greybot $@ >> IFS=$oIFS >> >> (We just do: declare -r oIFS=$IFS >> the start of our scripts, as it makes life easier in the long-run.) > > Sigh... I think it's better to just live with the extra comma :p >
Pfft, you were already using an array: $(IFS=,; echo "${LinkedIn[*]}") would've done. Since there was a subshell there, no need to worry about saving IFS. Reason I mentioned it is because: unset IFS isn't the same, and is generally useless compared to IFS=$oIFS ime. (The isArr line just seemed better than '# if this is not an array..')


Subject Author
Re: [gentoo-project] Re: Re: New developer: Ron Gemeinhardt (timebandit) Ron Gemeinhardt <timebandit@g.o>