From owner-freebsd-questions Tue Jan 11 5:40:24 2000 Delivered-To: freebsd-questions@freebsd.org Received: from dorifer.heim3.tu-clausthal.de (dorifer.heim3.tu-clausthal.de [139.174.243.252]) by hub.freebsd.org (Postfix) with ESMTP id 3ECD815191 for ; Tue, 11 Jan 2000 05:40:18 -0800 (PST) (envelope-from olli@dorifer.heim3.tu-clausthal.de) Received: (from olli@localhost) by dorifer.heim3.tu-clausthal.de (8.9.3/8.9.3) id OAA30067; Tue, 11 Jan 2000 14:39:49 +0100 (CET) (envelope-from olli) Date: Tue, 11 Jan 2000 14:39:49 +0100 (CET) Message-Id: <200001111339.OAA30067@dorifer.heim3.tu-clausthal.de> From: Oliver Fromme To: freebsd-questions@FreeBSD.ORG, dl@tyfon.net Reply-To: freebsd-questions@FreeBSD.ORG Subject: Re: mathematics in sh X-Newsgroups: list.freebsd-questions In-Reply-To: <85eqqp$1sfn$1@atlantis.rz.tu-clausthal.de> User-Agent: tin/1.4.1-19991201 ("Polish") (UNIX) (FreeBSD/3.4-19991219-STABLE (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Dan Larsson wrote in list.freebsd-questions: > Is it possible to do mathematical ( simple calculations such as ($a + $b)/$c ) calculations in sh? I usually use ``expr'' for integer calculations, and ``dc'' for floating point stuff. I try to avoid the shell's arithmetic expansion, because it's not portable to all sh implementations. For more complicated stuff, I use awk. Or C, if appropriate. See ``man expr'', ``man dc'' and (if you don't like the RPN of dc) ``man bc''. > Or is perl better to use in this case? I think perl is never better to use. :-) Regards Oliver -- Oliver Fromme, Leibnizstr. 18/61, 38678 Clausthal, Germany (Info: finger userinfo:olli@dorifer.heim3.tu-clausthal.de) "In jedem Stück Kohle wartet ein Diamant auf seine Geburt" (Terry Pratchett) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message