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$1@ger.gmane.org
In Reply to: Re: [gentoo-project] Re: New developer: Ron Gemeinhardt (timebandit) by Nirbheek Chauhan
1 Nirbheek Chauhan wrote:
2
3 > On Fri, Sep 26, 2008 at 2:09 PM, Steve Long <slong@××××××××××××××××××.uk>
4 > wrote:
5 >> Nirbheek Chauhan wrote:
6 >>> $(for ACRONYM in ${LinkedIn}; do echo -en "${ACRONYM},"; done; echo -ne
7 >>> '\b')
8 >>>
9 >> Now that *is* fail ;-)
10 >
11 > Crap! I forgot, \b only works for displaying in the terminal; doesn't
12 > actually "backspace" :(
13 >
14 Eh works well enough for display (not file as you mentioned) it's just you
15 should know about "${arr[*]}" vs "${arr[@]}"
16 Both are designed to help with scriptin; the first with exactly this issue,
17 and the latter with handling array parameters correctly, analagous to "$@"
18 and "$*".
19 Check out http://wooledge.org:8000/BashFAQ/073 for more nice stuff you can
20 do with array expansions (as well as scalars.)
21 >>
22 >>> So, where's my free review? ;p
23 >>>
24 >> isArr LinkedIn || LinkedIn=($LinkedIn)
25 >> oIFS=$IFS
26 >> IFS=, # This line and next are what you should
27 >> echo "${LinkedIn[*]}" # be aware of. cf: /msg greybot $@
28 >> IFS=$oIFS
29 >>
30 >> (We just do: declare -r oIFS=$IFS
31 >> ..at the start of our scripts, as it makes life easier in the long-run.)
32 >
33 > Sigh... I think it's better to just live with the extra comma :p
34 >
35 Pfft, you were already using an array: $(IFS=,; echo "${LinkedIn[*]}")
36 would've done. Since there was a subshell there, no need to worry about
37 saving IFS. Reason I mentioned it is because: unset IFS
38 isn't the same, and is generally useless compared to IFS=$oIFS ime.
39 (The isArr line just seemed better than '# if this is not an array..')

Replies

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