bug-sh-utils
[Top][All Lists]
Advanced

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

Re: Bug in expr?


From: Jim Meyering
Subject: Re: Bug in expr?
Date: Thu, 03 Jul 2003 11:42:18 +0200

MONWHEA JENG <address@hidden> wrote:
>       I think there is a bug in expr. When I type
> "expr 2 * 3", I get "expr: syntax error." The man page for expr
> leads me to think that I should get 6.

Thanks, but that's not a bug.
Your shell is expanding the `*' to a list of all (or most)
of the files in your current directory, so it's as if you'd
typed e.g.,

  expr 2 file.txt bar.txt foo.c ... 3

That's obviously not what you intended.
Instead, you should `escape' the asterisk: e.g.,
  expr 2 '*' 3
or
  expr 2 \* 3

FYI, if you have a similar problem in the future,
I suggest you try to see if someone has reported or discussed
one like it.  One way to do that is to search using Google.com.
In this case, I'd start by searching for the diagnostic, e.g.,
(put double quotes around the exact error message):

  "expr: syntax error"

but that was too general and didn't find anything promising
in the first page of matches.  So I added a word:

  "expr: syntax error" multiply

and with that, the first three matches answer your question.




reply via email to

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