Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #16396

Re: mc finds more than `find` finds?

From Richard Kettlewell <rjk@greenend.org.uk>
Newsgroups comp.os.linux.misc, alt.os.linux.debian, alt.os.linux.slackware
Subject Re: mc finds more than `find` finds?
Date 2015-11-29 20:24 +0000
Organization terraraq NNTP server
Message-ID <87a8pwtuz4.fsf@mantic.terraraq.uk> (permalink)
References (3 earlier) <n3cq2q$t2i$1@dont-email.me> <n3cqud$25a$1@dont-email.me> <87y4dh7sol.fld@barrow.com> <martijn-A8CAB7.16351529112015@news.individual.net> <87lh9g7fhj.fld@barrow.com>

Cross-posted to 3 groups.

Show all headers | View raw


floyd@apaflo.com (Floyd L. Davidson) writes:
> Martijn Dekker <martijn@inlv.demon.nl> wrote:
>> floyd@apaflo.com (Floyd L. Davidson) wrote:
>>
>>> Both opening and closing braces are reserved words.
>>
>>Yes, '{' and '}' are reserved words, but '{}' is not a reserved word.
>>(Something can only be a "word" if it's separated by blanks.)
>>
>>In any case the concept of a reserved word doesn't apply to command
>>arguments, so it's moot.
>
> You have removed and then changed the context to which
> my statement applied.
>
> The point is still very simple: braces are reserved
> words.  They do get "interpreted", and the statement I
> replied to incorrectly said they don't.
>
> Your definition of "word" is parochial, and does not
> necessarily apply to use of that term in a shell.  From
> the bash man page:
>
>  word   A sequence of characters considered as a single unit
>         by the shell.  Also known as a token.
>
> Clearly '{}' is a pair of tokens to the parsing engine.
> In some contexts they each cause a "word break", and in
> other contexts they do not.  When used to delimit a list
> they do not cause a break and must be surrounded by
> spaces.  When interpreted for expansion there is no need
> for a space.

‘Interpreted’ was surely the wrong word to use.  Everything’s
interpreted as something; the question is what it is interpreted as, and
what actually matters here is whether the interpretation of ‘{}’ is a
non-literal one.

‘Word’ is a specific category in the definition of the shell command
language, defined via the token recognition rules.  ‘{’ and ‘}’ have no
special interpretation here except as part of ‘${’; they certainly don’t
cause a “word break”.

‘Reserved word’ is a also a specific category, defined shortly after the
token recognition rules.  It’s a small category and ‘{}’ is not in it.

The other possibility, in shells that support it, is brace expansion,
something that happens later than and separately from tokenization.  But
(at least in the case of Bash) that also does not produce a non-literal
interpretation, since ‘{}’ is not a correctly-formed brace expansion.

TLDR: no, you don’t need to quote ‘{}’.

-- 
http://www.greenend.org.uk/rjk/

Back to comp.os.linux.misc | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

mc finds more than `find` finds? WhoCares@gmail.com - 2015-11-28 00:37 +0000
  Re: mc finds more than `find` finds? William Unruh <unruh@invalid.ca> - 2015-11-28 00:52 +0000
    Re: mc finds more than `find` finds? Arkadiusz Drabczyk <arkadiusz@domain.invalid> - 2015-11-28 16:15 +0000
      Re: mc finds more than `find` finds? William Unruh <unruh@invalid.ca> - 2015-11-28 17:59 +0000
        Re: mc finds more than `find` finds? Teemu Likonen <tlikonen@iki.fi> - 2015-11-28 20:07 +0200
          Re: mc finds more than `find` finds? William Unruh <unruh@invalid.ca> - 2015-11-28 20:44 +0000
            Re: mc finds more than `find` finds? Teemu Likonen <tlikonen@iki.fi> - 2015-11-29 12:41 +0200
        Re: mc finds more than `find` finds? Arkadiusz Drabczyk <arkadiusz@domain.invalid> - 2015-11-28 18:14 +0000
          Re: mc finds more than `find` finds? floyd@apaflo.com (Floyd L. Davidson) - 2015-11-28 11:52 -0900
            Re: mc finds more than `find` finds? Martijn Dekker <martijn@inlv.demon.nl> - 2015-11-29 16:35 +0100
              Re: mc finds more than `find` finds? floyd@apaflo.com (Floyd L. Davidson) - 2015-11-29 10:49 -0900
                Re: mc finds more than `find` finds? Richard Kettlewell <rjk@greenend.org.uk> - 2015-11-29 20:24 +0000
                Re: mc finds more than `find` finds? floyd@apaflo.com (Floyd L. Davidson) - 2015-11-29 14:09 -0900
                Re: mc finds more than `find` finds? Richard Kettlewell <rjk@greenend.org.uk> - 2015-11-30 09:24 +0000
                Re: mc finds more than `find` finds? Eef Hartman <E.J.M.Hartman@gmail.com> - 2015-11-30 10:08 +0000
              Re: mc finds more than `find` finds? William Unruh <unruh@invalid.ca> - 2015-11-29 20:07 +0000
              Re: mc finds more than `find` finds? Eef Hartman <E.J.M.Hartman@gmail.com> - 2015-11-29 20:10 +0000
            Re: mc finds more than `find` finds? no.top.post@gmail.com - 2016-01-04 23:07 +0000
              Re: mc finds more than `find` finds? The Natural Philosopher <tnp@invalid.invalid> - 2016-01-04 23:27 +0000
                Re: mc finds more than `find` finds? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2016-01-04 19:28 -0500
                Re: mc finds more than `find` finds? The Natural Philosopher <tnp@invalid.invalid> - 2016-01-05 14:04 +0000
                Re: mc finds more than `find` finds? Richard Kettlewell <rjk@greenend.org.uk> - 2016-01-05 18:12 +0000
              Re: mc finds more than `find` finds? Jerry Peters <jerry@example.invalid> - 2016-01-05 21:05 +0000
  Re: mc finds more than `find` finds? marrgol <marrgol@address.invalid> - 2015-11-28 02:22 +0100
  Re: mc finds more than `find` finds? Joe Beanfish <joebeanfish@nospam.duh> - 2015-11-30 15:59 +0000
    Re: mc finds more than `find` finds? Unknown <dog@gmail.com> - 2016-01-03 12:52 +0000

csiph-web