shopt-option
promptvars shell option
Enables parameter, command and arithmetic expansion and quote removal in decoded prompt strings. Untrusted prompt text can therefore be dangerous. This example uses a fixed synthetic variable and inspects actual prompts through a PTY. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Use interactive Bash with default key bindings; expected visible result: demo:run.
Formal Syntax & Structure
bash syntaxbash
shopt -s promptvars; shopt -u promptvarsReturn Value
exit status
Returns zero on success and nonzero on failure; option queries return zero when enabled.
Working Example
Example Snippetbash
# In fresh interactive Bash:label=demoshopt -s promptvarsPS0='${label}:'printf 'run\n'