3 ms·
Does bash have an option to write out the history before running the command? Usually history is written in PROMPT_COMMAND, which runs after the command comple
by aidenn0 6y ago
Does bash have an option to write out the history before running the command? Usually history is written in PROMPT_COMMAND, which runs after the command completes.
- jcynix 6y agoI don't know about bash, but zsh allows you to define a shell function "zshaddhistory" which is running right before a command is executed.
- joombaga 6y agoNot exactly, but there's $PS0 if you have bash 4.4+. https://stromberg.dnsalias.org/~strombrg/PS0-prompt/ https://stromberg.dnsalias.org/~strombrg/PS0-prompt/ (Thanks Dan!)
- aidenn0 6y agoThanks! I must be blind, I was looking in the bash man page right around PS1 and somehow didn't see this, but it's definitely there.
- bandie91 6y agoyes, using the DEBUG trap.