9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Peter A. Cejchan" <tyapca7@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] empty *
Date: Thu, 14 Jun 2012 11:32:56 +0200	[thread overview]
Message-ID: <CAM6ozu51kzDLxB0KoT96udomrKyHWuHvwqSum6=aXmonpr8kXQ@mail.gmail.com> (raw)
In-Reply-To: <CACm3i_g9m6sVaBvvydKYyBxwE=NGYmhmpM4Nko6gE5uUngSwXA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1235 bytes --]

This is from manpage, but I not sure what _exactly_ it means, and whether
it applies to your problem:
          Care should be taken when using the shell metacharacters
          $*[^|()=\ and newline in pattern; it is safest to enclose
          the entire expression in single quotes '...'.  An expression
          starting with '*' will treat the rest of the expression as
          literal characters.

more strange behavior:
% echo foo.c | 9 grep '*\.c'
%
% echo foo.c | 9 grep '*.c'
foo.c
% echo fooxc | 9 grep '*.c'
%
% echo fooxc | 9 grep '.*.c'
fooxc
% echo fooxc | 9 grep '.*\.c'
%
% echo foo.c | 9 grep '.*\.c'
foo.c
% echo foo.c | 9 grep '*foo.c'
foo.c
% echo foo.c | 9 grep '*.00.c'
%

Looks like
          " An expression
          starting with '*' will treat the rest of the expression as
          literal characters."
(see above) really applies (for unknown reasons).


However, I am just a 'toy programmer', so you were warned ;-)
Regards,
++pac


On Thu, Jun 14, 2012 at 10:28 AM, Gorka Guardiola <paurea@gmail.com> wrote:

> While playing with grep, I was suprised by grep '*\.c' not giving
> an error (* is missing an operand). Arguably * applied to empty ... [snip]
>

[-- Attachment #2: Type: text/html, Size: 1744 bytes --]

  reply	other threads:[~2012-06-14  9:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-14  8:28 Gorka Guardiola
2012-06-14  9:32 ` Peter A. Cejchan [this message]
2012-06-14  9:54   ` Gorka Guardiola
2012-06-14  9:42 ` Anthony Martin
2012-06-14 13:29   ` erik quanstrom
     [not found] ` <CAM6ozu51kzDLxB0KoT96udomrKyHWuHvwqSum6=aXmonpr8kXQ@mail.gmail.c>
2012-06-14 13:28   ` erik quanstrom
     [not found] <CACm3i_g9m6sVaBvvydKYyBxwE=NGYmhmpM4Nko6gE5uUngSwXA@mail.gmail.c>
2012-06-14 13:33 ` erik quanstrom
2012-06-14 13:38   ` Gorka Guardiola
     [not found]   ` <CACm3i_hoeuq10w5=Ri+-nocm1Str2USwTBW1m5iuhSxdU3_pMA@mail.gmail.c>
2012-06-14 13:44     ` erik quanstrom
2012-06-14 14:00       ` tlaronde
2012-06-14 14:13         ` Gorka Guardiola
2012-06-14 14:36           ` tlaronde
2012-06-14 14:49             ` erik quanstrom
2012-06-14 15:08               ` tlaronde
     [not found]         ` <CACm3i_hRKnkDW6SgFQQ3B4zfr3UHim=-x_uA0iYYRzZz0W8Xag@mail.gmail.c>
2012-06-14 14:46           ` erik quanstrom
2012-06-14 14:50             ` Gorka Guardiola
2012-06-14 14:05       ` Lucio De Re

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAM6ozu51kzDLxB0KoT96udomrKyHWuHvwqSum6=aXmonpr8kXQ@mail.gmail.com' \
    --to=tyapca7@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).