From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([69.77.167.62] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1KkPBD-00077u-E7 for garchives@archives.gentoo.org; Mon, 29 Sep 2008 20:17:15 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F2C3BE03FB; Mon, 29 Sep 2008 20:17:14 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id CCC34E03FB for ; Mon, 29 Sep 2008 20:17:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id AF2016435F for ; Mon, 29 Sep 2008 20:17:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at gentoo.org X-Spam-Score: -1.469 X-Spam-Level: X-Spam-Status: No, score=-1.469 required=5.5 tests=[AWL=0.062, BAYES_00=-2.599, RCVD_IN_DNSWL_LOW=-1, RCVD_NUMERIC_HELO=2.067, WEIRD_PORT=0.001] Received: from smtp.gentoo.org ([127.0.0.1]) by localhost (smtp.gentoo.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id z-jBeHBzhX+M for ; Mon, 29 Sep 2008 20:17:06 +0000 (UTC) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id A392A64B1E for ; Mon, 29 Sep 2008 20:17:04 +0000 (UTC) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KkPAy-0007mu-9v for gentoo-project@gentoo.org; Mon, 29 Sep 2008 20:17:00 +0000 Received: from 91.85.135.147 ([91.85.135.147]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 29 Sep 2008 20:17:00 +0000 Received: from slong by 91.85.135.147 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 29 Sep 2008 20:17:00 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: gentoo-project@lists.gentoo.org From: Steve Long Subject: [gentoo-project] Re: Re: New developer: Ron Gemeinhardt (timebandit) Date: Mon, 29 Sep 2008 21:08:00 +0100 Message-ID: References: <7c612fc60809220552rccadc38me3113a64b4b95b47@mail.gmail.com> <8b4c83ad0809220614n514de148gd5694954ba60cb76@mail.gmail.com> <8b4c83ad0809282227g249e4cfeo7d195fd3672b4536@mail.gmail.com> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Project discussion list X-BeenThere: gentoo-project@lists.gentoo.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 91.85.135.147 User-Agent: KNode/0.10.9 Sender: news X-Archives-Salt: 34d81c2b-c82c-465d-82dd-5a3ef61fb7d1 X-Archives-Hash: a0952397d226c59db69e048bacf6e394 Nirbheek Chauhan wrote: > On Fri, Sep 26, 2008 at 2:09 PM, Steve Long > 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 http://wooledge.org:8000/BashFAQ/073 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 >> ..at 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..')