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

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

expr 2 * 2


From: Bob Proulx
Subject: expr 2 * 2
Date: Wed, 22 Nov 2000 11:29:07 -0700 (MST)

> sir,
>     Multiplication is not wokrking
> example
>      expr 2 * 2
> it is throwing syntax error

Thank you for your report but that is a usage error and not a bug.
The '*' character is being expanded by the command shell as is proper.
The expr program is not seeing the '*' it is seeing the expansion.
You may verify this with the echo command.

  echo expr 2 * 2

You must quote shell metacharacters when used on the command line to
prevent them from being expanded.

  expr 2 '*' 2

More information about the command shell can be found in the online
man pages or online info pages.  However, I suggest a good book on
UNIX such as the O'Reilly nutshell handbooks.

Bob Proulx



reply via email to

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