bash-preexec
« Back to VersTracker
Description:
Preexec and precmd functions for Bash (like Zsh)
Type: Formula  |  Latest Version: 0.6.0@0  |  Tracked Since: Dec 17, 2025
Links: Homepage  |  formulae.brew.sh
Category: Developer tools
Tags: bash shell hooks zsh developer-tools
Install: brew install bash-preexec
About:
bash-preexec is a library that provides preexec and precmd hook functions for Bash, mimicking the functionality found in Zsh. It allows users to execute code before and after every command, enabling advanced shell customization. This tool is essential for developers looking to implement features like command history search, dynamic prompts, or session logging.
Key Features:
  • Provides preexec and precmd hooks for Bash
  • Mimics Zsh-like functionality in Bash environments
  • Lightweight and easy to integrate
  • Enables advanced shell scripting and customization
Use Cases:
  • Implementing custom command history or search functionality
  • Creating dynamic shell prompts that update before each command
  • Logging shell activity or auditing commands for security
Alternatives:
  • bash-preexec (forks) – Upstream is maintained; forks may offer experimental features but lack official support.
  • Zsh built-in hooks – Native to Zsh, but not applicable for Bash users without this library.
License: MIT
Bottles available for: all
Important Notes:
Add the following line to your bash profile (e.g. ~/.bashrc, ~/.profile, or ~/.bash_profile)
  [ -f $HOMEBREW_PREFIX/etc/profile.d/bash-preexec.sh ] && . $HOMEBREW_PREFIX/etc/profile.d/bash-preexec.sh
Version History
Detected Version Rev Change Commit