Re: Bug Report about "expr".
[email protected] (Bob Proulx) Thu, 12 Sep 2002 10:04:54 -0600
| Newsgroups | gmane.comp.gnu.sh-utils.bugs |
|---|---|
| Message-ID | <[email protected]> |
Michel Bouchet <[email protected]> [2002-09-12 17:36:08 +0900]: > I noticed the folowing under Linux Mandrake 8.2, with the expr command : > > [eagle@WA_Mozart eagle]$ expr 2 * 3 > expr: syntax error > [eagle@WA_Mozart eagle]$ > > Shouldn't the answer be 6 and not an error message ? No. You are forgetting that the shell is expanding file name globs such as the '*' character. You need to protect the '*' from the shell. echo expr 2 * 3 Lots of files match *. Must prevent that. echo expr 2 '*' 3 That will work. Now do it for real. expr 2 '*' 3 This is one of the FAQs. And FAQs are by definition asked frequently. You might want to check out the list. http://www.gnu.org/software/fileutils/doc/faq/ Bob