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

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

Re: Bug Report about "expr".


From: Bob Proulx
Subject: Re: Bug Report about "expr".
Date: Thu, 12 Sep 2002 10:04:54 -0600
User-agent: Mutt/1.4i

Michel Bouchet <address@hidden> [2002-09-12 17:36:08 +0900]:
> I noticed the folowing under Linux Mandrake 8.2, with the expr command :
> 
> address@hidden eagle]$ expr 2 * 3
> expr: syntax error
> address@hidden 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




reply via email to

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