Skip to content
Jean-Raphaël GAGLIONE edited this page Dec 22, 2017 · 12 revisions

NAME

++ - increment a variable by one

SYNOPSIS

++ VAR [MIN] [MAX]

DESCRIPTION

Increment a variable by one.

If bounds are specified, switch to modular arithmetic, and the variable will iterate within the boundaries.
The second bound is set to zero if not given.
An unset variable will be set to the least bound if the last one is defined.

With boundaries given, when the variable (re)start a cycle the error code 255 is returned (instead of 0). This let you chain the commands with ||.

OPTIONS

VAR : the incremented variable

MIN, MAX : range boundaries (order does not matter)

EXIT STATUS

0 : if OK and no revolution

1 : if invalid parameters

2 : if previous value is inconsistent

255 : if OK and revolution (modular arithmetic)

EXAMPLES

++ SECOND 59 || ++ MINUTE 59 || ++ HOUR 23

SEE ALSO

--

Command manual

Clone this wiki locally