expansion

Bash Alternate for a nonempty value

Yields the alternate word when p is nonempty, otherwise an empty string. Does not assign.

Formal Syntax & Structure

bash syntaxbash
${p:+word}

Return Value

shell expansion result

Yields the alternate word when p is nonempty, otherwise an empty string. Does not assign.

Working Example

Example Snippetbash
p=readyprintf '%s\n' "${p:+supplied}"
Bash Reference