help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] floating point arithmetic


From: Chris F.A. Johnson
Subject: Re: [Help-bash] floating point arithmetic
Date: Tue, 31 Oct 2017 17:08:33 -0400 (EDT)
User-agent: Alpine 2.10 (DEB 1266 2009-07-14)

On Tue, 31 Oct 2017, João Eiras wrote:

I have my own little bash script for this use case:

$ cat calc
IFS=""
awk "BEGIN { print (${*:-0}); }" /dev/null

I use this:

calc()
{
  awk 'BEGIN {print '"${*//x/*}"'}'
}

...so that I can use 'x' instead of '*', which needs quoting.

--
Chris F.A. Johnson, <http://cfajohnson.com>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]