💾 Archived View for rawtext.club › ~s0kx › pure-sh-bible › parameter-expansion.gmi captured on 2024-02-05 at 11:26:30. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
Remove shortest match of pattern from start of string.
${VAR#PATTERN}
Remove longest match of pattern from start of string.
${VAR##PATTERN}
Remove shortest match of pattern from end of string.
${VAR%PATTERN}
Remove longest match of pattern from end of string.
${VAR%%PATTERN}
Lenght of var in characters.
${#VAR}
If VAR is empty or unset, use STRING as its value.
${VAR:-STRING}
If VAR is unset, use STRING as its value.
${VAR-STRING}
If VAR is empty or unset, set the value of VAR to STRING.
${VAR:=STRING}
If VAR is unset, set the value of VAR to STRING.
${VAR=STRING}
If VAR is not empty, use STRING as its value.
${VAR:+STRING}
If VAR is set, use STRING as its value.
${VAR+STRING}
Display an error if empty or unset.
${VAR:?STRING}
Display an error if unset.
${VAR?STRING}