[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 'expr' command not working with option *
From: |
Eric Blake |
Subject: |
Re: 'expr' command not working with option * |
Date: |
Thu, 11 Aug 2005 07:17:20 -0600 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Windows/20050317) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Saran on 8/11/2005 4:43 AM:
> To whom so ever it may concern..
>
> Hi,
> I find that the expr command in my linux shell is not working for multiplying
> two arguments. please help me out how could i multiply two numbers in a shell
> and how could i use the command in my shell scripts..
> when i type expr 2 * 3 it is giving syntax error.
> whereas if i type expr 2 + 3 it is giving me the correct result '5'.
This is turning into a FAQ; although the FAQ page at
http://www.gnu.org/software/coreutils/faq/coreutils-faq.html doesn't
mention expr by name, it does mention problems with * as a shell
metacharacter, which needs to be quoted.
Try "echo expr 2 * 3" to see what you are really doing. And compare that
to "echo expr 2 \* 3".
- --
Life is short - so eat dessert first!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFC+0/g84KuGfSFAYARAuZRAJ9DooJLmd0kf2igT2kCDUUblsrkxwCeLy8J
ns7moJ6uG53FvYoe0cUKGmU=
=ni7b
-----END PGP SIGNATURE-----