How can I make Bash (or Zsh) run a particular command before each entered command?

Posted by Peeja on Super User See other posts from Super User or by Peeja
Published on 2012-03-23T17:31:57Z Indexed on 2012/03/28 5:34 UTC
Read the original article Hit count: 184

Filed under:
|

I'd like to configure Bash to run a particular command before running each command line I enter at the prompt. Specifically, I'd like to tell Vim (which is running in another terminal) to write all open buffers, because in my workflow if anything's unsaved when I leave Vim it's a mistake.

Is there an option for this in Bash? If not, is there an option in Zsh?

(There is a readline-based solution that somewhat fits this problem on another question, but it feels a bit hacky. It'll take it as a last resort.)

© Super User or respective owner

Related posts about bash

Related posts about zsh