[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
expr usage (was: Need info.....ugent....)
From: |
Eric Blake |
Subject: |
expr usage (was: Need info.....ugent....) |
Date: |
Tue, 03 Mar 2009 05:55:37 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.6.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[please choose a more descriptive subject line, to ensure your message is
not discarded before it is read]
According to vimal raj on 3/2/2009 9:02 AM:
Hello Vimalraj,
> case $op in
> 1) expr '$c=$a+$b';;
expr requires each and every token to be a separate argument.
Additionally, it looks like you want to assign the shell variable c to the
result of that expression. You want to write something like this instead:
c=`expr "$a" "*" "$b"`
or, if you are using a POSIX-compliant shell that supports $(()):
: $(( c = $a * $b ))
> 1. How to install the 'C' Compiler through CD?
Ask that to your local Ubuntu user's group; the GNU coreutils project does
not maintain a C compiler.
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkmtKMkACgkQ84KuGfSFAYBbyACgtTKaRE9DveUuPTf5zeD7thhD
xZcAnitUFzX3YRj7+piCc5VrIIqZ6YYf
=0RxY
-----END PGP SIGNATURE-----