Does bash have a hook that is run before executing a command?
- by Gilles
In bash, can I arrange for a function to be executed just before running a command?
There is $PROMPT_COMMAND, which is executed before showing a prompt, i.e., just after running a command.
Bash's $PROMPT_COMMAND is analogous to zsh's precmd function; so what I'm looking for is a bash equivalent to zsh's preexec.
Example applications: set your terminal title to the command being executed; automatically add time before every command.