[comp.unix.questions] Negative numbers as expr

robert@pvab.UUCP (Robert Claeson) (08/10/87)

I tried to add a negative number with a non-negative number by using the
expr(1) command. It responded with "non-numeric argument" (BSD 4.2) or
"unknown operation" (SVR2). Anyone who knows how to express negative
numbers with expr?

-- 
SNAIL:	Robert Claeson, PVAB, P.O. Box 4040, S-171 04 Solna, Sweden
UUCP:	{seismo,mcvax,munnari}!enea!pvab!robert
ARPA:	enea!pvab!robert@call intevec

bamford@ihlpg.ATT.COM (Harold E. Bamford) (08/11/87)

This seems to work for me:

	expr -1 + 10

It replies with "9"

What exactly are you giving to expr?
-- 
				Harold Bamford, AT&T Bell Labs
				IHP 2F-524 (312) 416-7397
				ihnp4!ihlpg!bamford

robert@pvab.UUCP (Robert Claeson) (08/12/87)

In article <3628@ihlpg.ATT.COM> bamford@ihlpg.UUCP (Harold E. Bamford) writes:

>This seems to work for me:
>
>	expr -1 + 10
>
>It replies with "9"
>
>What exactly are you giving to expr?

When I do the same on my Sun, it says "non-numeric argument".
A machine running SVR2.2 says "expr: unknown operation\n-1".
I haven't had a chanse to run it on the 3b2 w/SVR3.1.

-- robert
-- 
SNAIL:	Robert Claeson, PVAB, P.O. Box 4040, S-171 04 Solna, Sweden
UUCP:	{seismo,mcvax,munnari}!enea!pvab!robert
ARPA:	enea!pvab!robert@seismo.arpa