2 ms·
You could implement PS0 in an older Bash which doesn't have it. See here: http://superuser.com/questions/175799/does-bash-have-a-hook-that-is-run-before-execu
by kazinator 10y ago
You could implement PS0 in an older Bash which doesn't have it.
See here:
http://superuser.com/questions/175799/does-bash-have-a-hook-that-is-run-before-executing-a-command http://superuser.com/questions/175799/does-bash-have-a-hook-...
There is way to hook into command execution. And that piece of code you hook in could look at a variable called PS0 and process it the way Bash 4.4 does it now.
This new PS0 might provide a pre-execution hook of its own. If it performs $(....) command substitution (like PS1 does!), it provides a way of executing arbitrary code. If the entire prompt is "$(some-command ...)" and that command produces no output, then you have a de facto pure hook.
- p4bl0 10y agoYes that's what I did, see my other comment where I link to one of my old blogpost detailing it. My point is that PS0 will make that cleaner :).