bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why are curly braces different than parens for cmd grouping?


From: Linda Walsh
Subject: Why are curly braces different than parens for cmd grouping?
Date: Fri, 24 Jul 2009 19:00:24 -0700
User-agent: Thunderbird 2.0.0.22 (Windows/20090605)

A previous note had me wondering why the syntax for using
curly braces to group expressions wasn't able to be the same as
using 'paren's.

I.e. on the same line, why do I need an extra ";" before the '}':
(ls) works
{ls} fails -- needs {ls;}

I know braces can be part of a filename, but they can also be quoted
to get around the shell interpreting them if there is confusion,
OR the shell could try to be smarter about "curlies" than parens..
like:
(ls /tmp)
won't ever be interpreted as looking for file "/tmp\)".
With curlies, to reduce backwards compat issues, one could parse the
curlies in a filename and see if the '}' might be closing an opening '{'
that is part of the filename.

I.e.:
 {
   ls aaa}

would be interpreted as a closing curly brace, but
 {
   ls a{aa}

would not -- as it's likely  a closing brace in a user's filename.

Maybe an 'option'?: to syntactically treat braces as parens?
Then if one wanted a curly brace of any sort in a filename, they'd
would quote it.
-- and if you want a curly brace of any sort in
a filename, you'd have to quote it...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]