Shell Parameter Expansion has a complete list of all parameter expansions syntax with examples, which also apply to arrays. Scroll past the paragraphs.
Detail hidden in paragraphs: the first 4 examples (the parameter value test expansions, like :-) do NOT need the colon. The colon means "unset or empty" and without the colon the tests just means "unset"
Documented ...somewhere?: when using a (numeric) variable for the key of an indexed array, or a variable for the offset/length, you can reference the variable without the expansion identifier ($)
This applies to any situation where shell arithmetic can be performed
Shell Arithmetic has a complete list of shell arithmetic operators
Detail hidden in first paragraph: the syntax is valid in the following:
letexpression[s]
declare -iexpression[s]
local -iexpression[s]
((expression[s])) and $((expression[s]))
Detail hidden later: bash supports the base syntax of
base#value, which looks like it's covered.
Builtin references pages
Bash Builtins can direct you to where to find builtin commands/functions.
Right now, these are supported:
$PARAMETER
${PARAMETER}
These are not yet supported:
${!PARAMETER}
${PARAMETER^}
${PARAMETER^^}
${PARAMETER,}
${PARAMETER,,}
${PARAMETER~}
${PARAMETER~~}
${!PREFIX*}
${!PREFIX@}
${PARAMETER#PATTERN}
${PARAMETER##PATTERN}
${PARAMETER%PATTERN}
${PARAMETER%%PATTERN}
${PARAMETER/PATTERN/STRING}
${PARAMETER//PATTERN/STRING}
${PARAMETER/PATTERN}
${PARAMETER//PATTERN}
${#PARAMETER}
${PARAMETER:OFFSET}
${PARAMETER:OFFSET:LENGTH}
${PARAMETER:-WORD}
${PARAMETER-WORD}
${PARAMETER:=WORD}
${PARAMETER=WORD}
${PARAMETER:+WORD}
${PARAMETER+WORD}
${PARAMETER:?WORD}
${PARAMETER?WORD}
Here's some documentation for future me, courtsey of akpircher
Quick Reference Guides
GNU Bash Documentation
Shell Parameter Expansion has a complete list of all parameter expansions syntax with examples, which also apply to arrays. Scroll past the paragraphs.
:-
) do NOT need the colon. The colon means "unset or empty" and without the colon the tests just means "unset"$
)Shell Arithmetic has a complete list of shell arithmetic operators
let
expression[s]
declare -i
expression[s]
local -i
expression[s]
((
expression[s]
))
and$((
expression[s]
))
base#value
, which looks like it's covered.Builtin references pages
set
andshopt
commands (not actually listed elsewhere)