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

-- 
[EMAIL PROTECTED] mailing list

Reply via email to