Re: [dwm] Done Before: dwm stat scripts!

From: Riccardo Murri <riccardo.murri_AT_gmail.com>
Date: Tue, 2 Oct 2007 18:12:56 +0200

On 10/2/07, Enno Gottox Boland <gottox_AT_gmail.com> wrote:
> > ...but it works...
> It calculates as well as Excel :)

Oooooops!

Still, it's faster :-)

> ceil n.0 gives n+1
> e.g. ceil 0.0 gives 1
>

if your system has /usr/bin/printf (not the bash builtin)::

  $ ceil () { /usr/bin/printf '%.0f' "$1"; }

othwerwise::

  $ ceil () { floor="$(floor "$1")"; if expr match "$1"
'[0-9][0-9]*\.00*' >/dev/null; then echo $floor; else expr $floor + 1;
fi; }
  $ ceil 0.0
  0
  $ ceil 0.000
  0
  $ ceil 0.1
  1

Riccardo
Received on Tue Oct 02 2007 - 18:12:59 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:57:01 UTC