On 08/01/2012 07:49 AM, Jari Vuoksenranta wrote:
> Would it break anything if "*" was replaced with a "x" (on command line ONLY)?
> I mostly use expr in such easy div / mul tasks...

I suppose such an extension would be okay, however, how would you
reliably know whether you have a new enough coreutils providing the
extension, when you might as well just stick with the syntax
standardized by POSIX?

> 
> "expr (GNU coreutils) 8.15 Packaged by Cygwin (8.15-1)"

Furthermore, why are you using 'expr' in the first place?  Spawning a
new process is expensive, and it is much faster to use shell built-in
arithmetic (also guaranteed by POSIX and present on cygwin).  Change
your script from:

expr 3 \* 4

to

echo $((3 * 4))

for faster execution, and so that you no longer have to escape the *,
all without proposing any changes to expr.

-- 
Eric Blake   [email protected]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to