$(( ))

$[ ]

The arithmetic expression is evaluated and the resulting value replaces the whole $((...)) construct:

Please do not use the second form $[ ... ]! It's deprecated. The preferred and standardized form is $(( ... ))!

Arithmetic expressions are used in several situations:

* arithmetic evaluation command
* arithmetic expansion
* substring parameter expansion
* the ''let'' builtin command
* C-style for loop
* array indexing
* conditional expressions

Arithmetic expressions are used in several situations:

* arithmetic evaluation command
* arithmetic expansion
* substring parameter expansion
* the ''let'' builtin command
* C-style for loop
* array indexing
* conditional expressions
* Assignment statements, and arguments to declaration commands of variables with the integer attribute.

Synopsis

let arg [arg ...]

Description

The let builtin command evaluates each supplied word from left to right as an arithmetic expression and returns an exit code according to the truth value of the rightmost expression.

* 0 (TRUE) when arg evaluated to not 0 (arithmetic "true")
* 1 (FALSE) when arg evaluated to 0 (arithmetic "false")

Arithmetic expressions are used in several situations:

* arithmetic evaluation command
* arithmetic expansion
* substring parameter expansion
* the ''let'' builtin command
* C-style for loop
* array indexing
* conditional expressions
* Assignment statements, and arguments to declaration commands of variables with the integer attribute.

Synopsis

let

Description

The let builtin command evaluates the arithmetic expression and returns the exit codes

* 0 (TRUE) when evaluated to not 0 (arithmetic "true")
* 1 (FALSE) when evaluated to 0 (arithmetic "false")

I know I can do simple arithmetic in shell scripts, like so:

#!/bin/bash
((sum = 1 + 2))
echo sum

This will output 3 on execution. My question now is, can this kind of expressions be used in crontab? For example, see this line:

03,13,23,33,43,53 * * * * ~/DoSomeStuff.sh

The minutes could be specified as x+3 with x the expression */10, which can be used in crontabs.

Can peoples combine arithmetic expansion and brace expansion?

$ for i in {$((1 + 1))..5}; do echo $i; done;
{2..5}
$ echo "bash laughs at me"

Synopsis

(( ))

Description

This command evaluates the arithmetic expression .

If the expression evaluates to 0 then the exit code of the expression is set to 1 (FALSE). If the expression evaluates to something else than 0, then the exit code of the expression is set to 0 (TRUE). For this return code mapping, please see this section.