Re: Easy math in bash?

From: Adam McKee <amckee_at_no.spam.please>
Date: Sun Jul 11 1999 - 14:46:50 CST

This should work:

#! /bin/sh
i=1
i=$[i + 1]
echo $i

        -- Adam

On Sun, 11 Jul 1999, Les Klassen Hamm wrote:

> Greetings,
>
> Is there a relatively easy way to do some basic math in a bash shell
> script, or do I need to fire up a little perl script? I have a shell script
> that extracts a list of numbers, which I want added together and then piped
> out to mail program. All the rest is no problem, but I can't think of an
> elegant or simple way to simply add the column of numbers together.
> Thanks,
> Les...
> -
> Saskatoon Linux Group Mailing List.
> -
> To unsubscribe, send mail to
> 'linux-request@slg.org' with
> 'unsubscribe' in the body.
>

-
Saskatoon Linux Group Mailing List.
-
To unsubscribe, send mail to
'linux-request@slg.org' with
'unsubscribe' in the body.
Received on Sun Jul 11 14:46:50 1999

This archive was generated by hypermail 2.1.8 : Sun Jan 09 2005 - 13:53:59 CST