expansion

Bash Require an assigned value

Rejects an unset scalar, but accepts an assigned empty string; failure exits a noninteractive shell nonzero.

Formal Syntax & Structure

bash syntaxbash
${p?word}

Return Value

shell expansion result

Rejects an unset scalar, but accepts an assigned empty string; failure exits a noninteractive shell nonzero.

Working Example

Example Snippetbash
p=printf '[%s]\n' "${p?Required}"
Bash Reference