invocation-option

Bash -v script [argument ...]

Enables verbose mode, displaying input lines as they are read, normally on stderr. This is not a trace of expanded arguments. Source text can contain sensitive data, so use synthetic scripts and avoid enabling this in production logs. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): demo; source captured.

Formal Syntax & Structure

bash syntaxbash
bash -v script [argument ...]

Return Value

exit status

See the example and command status; failures are nonzero.

Working Example

Example Snippetbash
printf '%s\n' 'value=demo' 'printf "%s\n" "$value"' > input.shbash --noprofile --norc -v input.sh > output 2> verbose || exit 1cat outputgrep -Fq '$value' verbose || exit 1printf 'source captured\n'
Bash Reference