From owner-freebsd-questions Sat May 16 08:27:54 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id IAA26634 for freebsd-questions-outgoing; Sat, 16 May 1998 08:27:54 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from darla.swimsuit.internet.dk (pm22-4.image.dk [194.234.169.68]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id IAA26625 for ; Sat, 16 May 1998 08:27:45 -0700 (PDT) (envelope-from leifn@internet.dk) Received: from darla.swimsuit.internet.dk (darla.swimsuit.internet.dk. [192.168.0.10]) by darla.swimsuit.internet.dk (8.8.8/8.8.8) with SMTP id RAA02928; Sat, 16 May 1998 17:29:21 +0200 (CEST) (envelope-from leifn@internet.dk) Date: Sat, 16 May 1998 17:29:21 +0200 (CEST) From: Leif Neland Reply-To: leifn@internet.dk To: Jon Hamilton cc: Child , questions@FreeBSD.ORG Subject: Re: sh/csh sums? In-Reply-To: <199805161336.GAA15216@hub.freebsd.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sat, 16 May 1998, Jon Hamilton wrote: > > In message , Child w > rites: > } HI all > } > } I am looking for a way to get sh/csh to do simple sums > } ie 145553/1024 > } > } thanks > } JS > > To pick a nit, that's not a sum, but to answer your question as it applies to > sh: > > $ echo $((145553/1024)) > 142 > Or: $ expr 145553 / 1024 You need spaces around the operators. * must be escaped \* just as \( and \) > Most older versions of sh will either not have this feature, or it'll be > limited to addition and subtraction. Newer (POSIX-ized) versions generally > do OK in this regard. expr is ok in old stuff too... Leif Neland leifn@internet.dk To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message