From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Icqi8-0008OF-Fb for garchives@archives.gentoo.org; Tue, 02 Oct 2007 22:59:28 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.14.1/8.14.0) with SMTP id l92MnaP5030565; Tue, 2 Oct 2007 22:49:36 GMT Received: from mail.marples.name (rsm.demon.co.uk [80.177.111.50]) by robin.gentoo.org (8.14.1/8.14.0) with ESMTP id l92Mlct9028235 for ; Tue, 2 Oct 2007 22:47:38 GMT Received: from [10.73.1.30] (uberpc.marples.name [10.73.1.30]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by mail.marples.name (Postfix) with ESMTP id 185AF190038 for ; Tue, 2 Oct 2007 23:46:04 +0100 (BST) Subject: Re: [gentoo-dev] Re: Re: Re: RFC: sh versionator.eclass From: Roy Marples To: gentoo-dev@lists.gentoo.org In-Reply-To: References: <200710012259.40589.uberlord@gentoo.org> <1191334716.2189.21.camel@uberlaptop.development.ltl> <1191335103.2189.22.camel@uberlaptop.development.ltl> <200710021830.26584.george@gentoo.org> <1191343930.2189.28.camel@uberlaptop.development.ltl> <1191354262.22700.6.camel@uberpc.marples.name> Content-Type: text/plain Organization: Gentoo Date: Tue, 02 Oct 2007 23:47:33 +0100 Message-Id: <1191365253.22700.21.camel@uberpc.marples.name> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Reply-to: gentoo-dev@lists.gentoo.org Mime-Version: 1.0 X-Mailer: Evolution 2.10.3 Content-Transfer-Encoding: 7bit X-Archives-Salt: 5032f0ca-62e3-4435-98b0-01b5f2751093 X-Archives-Hash: f3e4a0fea7a7c296aedc1a9c422e4009 On Tue, 2007-10-02 at 23:18 +0100, Steve Long wrote: > Roy Marples wrote: > > Everything in shell IS a command with the exception of variable > > assignment. Why do you think [ exist in /usr/bin? > > > Yes I know, it's the same reason greycat will often use test -e blah && > blahBlah to show where the command comes from. (Which is why you use 'help > test' to see what tests are actually available.) It doesn't change the fact > that quoting issues show up outside [[, and you need to be aware of them in > bash just as much as in sh. I agree. My argument is that [[ encourages no quoting, hence it showing up more As [ forces people to quote correctly, it should show up less outside of [ or [[ > IMO the real reason you have such an issue with quoting is the redundant > braces which are Gentoo house style; too many newbie scripters think that > cd ${S} is safe when it should be cd "${S}" or more simply cd "$S". I don't > buy the legibility argument since most people use syntax highlighting. It > just sets the parser up for a non-event (yes I am *that* fussy about > cycles.) My suspicion is that it came from echo "${RD}message$NO" Not helped by unpack ${A} which should not be quoted if >1 thing to to unpack. > > > Once you think "everything is a command" then quoting becomes a lot > > easier. [[ ]] removes this concept. > > > Yeah but the point is you learn about quoting for every other command, or > you simply won't be writing reusable scripts (assuming they actually work > for you at all.) Why not learn about quoting for everything? As it's so important, why should [[ be an exception? And as a prior email claimed, [[ sometimes needs quoting anyway just to muddy things even more. > > So in other words, [ ] always needs quotes whereas [[ ]] normally > > doesn't but could need quotes in corner cases. > > > > I know which I'd prefer - certainty over uncertainty. > > > Well to be absolutely honest I've never actually needed them, and I only > mentioned it for completeness as kojiro said there was some case (involving > array expansion iirc, so sh wouldn't even be able to express the metaphor, > let alone get in a twist about it.) It was definitely not the run-of-the > mill issue. I still would not give up pattern and regex matching (to name > my top two) in [[, and definitely not for the trade-down to sh, where you'd > be doing all kinds of odd syntax to get round the limitations of the > lowest-common denominator. Show me an ebuild that uses pattern and/or regex matching please? I don't think you're giving up all that much. [ ... ] This is the posix sh vs bash for eclasses thread, GNU userland vs BSD userland is next months flamewar ;) Thanks Roy -- gentoo-dev@gentoo.org mailing list