parameter-expansion

Bash @P transformation

Expands the value using prompt-string rules. Use only trusted prompt templates because prompt expansion may involve additional evaluation depending on shell options. This fixture uses the literal backslash escape for the shell version, not an external template. Bash-specific, tested on 5.2. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): version expanded.

Formal Syntax & Structure

bash syntaxbash
${parameter@P}

Parameters & Attributes

NameTypeDescription
parametershell parameterTrusted parameter to transform.

Return Value

expanded words

Expansion yields data rather than a separate command status.

Working Example

Example Snippetbash
template='\v'printf '%s\n' "${template@P}" | grep -Eq '^[0-9]+\.[0-9]+$' || exit 1printf 'version expanded\n'
Bash Reference