banshee is under active development: collectors will keep changing, and a version you publish will likely need adjustments. For stable use, wait for version 1.0.0.

Examples

banshee/examples-collection/examples/basics/

calculation

Example: + - * / %, number.round and the point that joins texts, on the uptime of a Linux.

  • example
  • basics
  • calculation
  • uptime
  • ssh

by banshee1 installation1 version

v1Latest

Published on October 27, 2026. First version in this collection.

Calculation

The operators of calculation and the point that joins texts, on the time since a Linux started: a number of days, and the same in words, "4 d 1 h".

How to read it

  • + - * / as in school; % is the rest of a division: $seconds % 86400 are the seconds left once the whole days are counted.
  • *, / and % come before + and -; what is between parentheses comes first of all.
  • number.round($n) rounds to a whole number, number.round($n, 2) keeps two decimals.
  • A text that is the writing of a number counts as that number in a calculation: $words[0], read from the command, divides.
  • The point joins texts, a number counting as its digits. It takes a blank on each side: $days . ' d ', never $days.' d '.
  • The point is under + and -: 'total ' . $a + $b reads 'total ' . ($a + $b).

To adapt it

  • **, +=, ++ do not exist: write $x * $x, $x = $x + 1.
  • The watch warns under 0.1 day, about two hours and a half after a restart.