variable
BASH_COMMAND
The command being executed or about to execute; in a trap it describes the command executing when the trap was triggered. Can reveal sensitive information; demonstrate only fixed synthetic code.
Formal Syntax & Structure
bash syntaxbash
$BASH_COMMANDReturn Value
string
The command being executed or about to execute; in a trap it describes the command executing when the trap was triggered. Can reveal sensitive information; demonstrate only fixed synthetic code.
Working Example
Example Snippetbash
trap 'printf "trace=%s\n" "$BASH_COMMAND" >&2' DEBUG:trap - DEBUG