On Thu, 27 Jan 2000, Jeff Smelser wrote:

> this worked great, thanks a lot!
> 
>                     
> On Thu, 27 Jan 2000, Bret Hughes wrote:
> 
> > Try some thing like this
> > 
> > 
> > #! /bin/sh
> > # addnums - adds two numbers input as args and outputs the result
> > newval=`expr $1 + $2`
> > echo 'the sum of ' $1 ' and ' $2 ' is ' $newval 

the more efficient way with bash is with the $((...)) operator,
which represents arithmetic built into the shell.

$ echo $((1+2))
3

the advantage to this approach is that you can be sloppy
with spacing, and you have not just simple arithmetic, but
bit shift operators.  same feature with the korn shell.

rday



-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to