variable
Bash SECONDS — elapsed shell seconds
Expands to integer seconds since shell invocation or since assignment plus the assigned value. Useful for coarse timing, not a monotonic high-resolution benchmark. This test checks the offset without requiring an exact elapsed duration. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): offset reached.
Formal Syntax & Structure
bash syntaxbash
${SECONDS}Return Value
integer
Elapsed whole seconds with the current assigned offset.
Working Example
Example Snippetbash
SECONDS=12s=$SECONDS(( s >= 12 )) || exit 1printf 'offset reached\n'