🍺 BREW Explorer

← all formulae

bash-preexec

brew install bash-preexec v0.6.0 MIT

Preexec and precmd functions for Bash (like Zsh)

1.4k
30-day installs · #1153
4.1k
90-day · #1203
17.0k
365-day · #1146
1.1k
★ GitHub stars · updated 2mo ago

GitHub topics

bash precmd preexec

Links

Caveats

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
Raw metadata
{
  "aliases": [],
  "alternatives": [],
  "build_dependencies": [],
  "categories": [],
  "caveats": "Add the following line to your bash profile (e.g. ~/.bashrc, ~/.profile, or ~/.bash_profile)\n  [ -f $HOMEBREW_PREFIX/etc/profile.d/bash-preexec.sh ] \u0026\u0026 . $HOMEBREW_PREFIX/etc/profile.d/bash-preexec.sh\n",
  "conflicts_with": [],
  "dependencies": [],
  "deprecated": 0,
  "deprecation_reason": null,
  "desc": "Preexec and precmd functions for Bash (like Zsh)",
  "disable_reason": null,
  "disabled": 0,
  "enrichment_fetched_at": "2026-06-20T23:35:46+00:00",
  "first_seen": "2026-06-20T23:34:18+00:00",
  "full_name": "bash-preexec",
  "github_default_branch": "master",
  "github_last_commit_at": "2026-06-19T10:04:30Z",
  "github_readme_excerpt": "[![Build Status](https://github.com/rcaloras/bash-preexec/actions/workflows/bats.yaml/badge.svg)](https://github.com/rcaloras/bash-preexec/actions/)\n[![GitHub version](https://badge.fury.io/gh/rcaloras%2Fbash-preexec.svg)](https://badge.fury.io/gh/rcaloras%2Fbash-preexec)\n\nBash-Preexec \n============\n\n**preexec** and **precmd** hook functions for Bash 3.1+ in the style of Zsh. They aim to emulate the behavior [as described for Zsh](http://zsh.sourceforge.net/Doc/Release/Functions.html#Hook-Functions).\n\n\u003ca href=\"https://bashhub.com\" target=\"_blank\"\u003e\u003cimg src=\"https://bashhub.com/static/web/images/bashhub-logo.png\" alt=\"Bashhub Logo\" width=\"200\"\u003e\u003c/a\u003e\n\nThis project is currently being used in production by [Bashhub](https://github.com/rcaloras/bashhub-client), [iTerm2](https://github.com/gnachman/iTerm2), and [Ghostty](https://ghostty.org/). Hype!\n\n## Quick Start\n```bash\n# Pull down our file from GitHub and write it to your home directory as a hidden file.\ncurl https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh -o ~/.bash-preexec.sh\n# Source our file to bring it into our environment\nsource ~/.bash-preexec.sh\n# Define a couple functions.\npreexec() { echo \"just typed $1\"; }\nprecmd() { echo \"printing the prompt\"; }\n```\n\n## Install\nYou\u0027ll want to pull down the file and add it to your bash profile/configuration (i.e ~/.bashrc, ~/.profile, ~/.bash_profile, etc). **It must be the last thing imported in your bash profile.**\n```bash\n# Pull down our file from GitHub and write it to your home directory as a hidden file.\ncurl https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh -o ~/.bash-preexec.sh\n# Source our file at the end of our bash profile (e.g. ~/.bashrc, ~/.profile, or ~/.bash_profile)\necho \u0027[[ -f ~/.bash-preexec.sh ]] \u0026\u0026 source ~/.bash-preexec.sh\u0027 \u003e\u003e ~/.bashrc\n```\n\n## Usage\nTwo functions **preexec** and **precmd** can now be defined and they\u0027ll be automatically invoked by bash-preexec if they exist.\n\n* `preexec` Execute",
  "github_repo": "rcaloras/bash-preexec",
  "github_stars": 1050,
  "github_topics": [
    "bash",
    "precmd",
    "preexec"
  ],
  "homepage": "https://github.com/rcaloras/bash-preexec",
  "homepage_og_description": null,
  "homepage_og_image": null,
  "homepage_title": null,
  "installs_30d": 1375,
  "installs_365d": 16980,
  "installs_90d": 4078,
  "keg_only": 0,
  "keg_only_reason": null,
  "last_seen": "2026-06-20T23:34:18+00:00",
  "license": "MIT",
  "llm_generated_at": null,
  "llm_model": null,
  "name": "bash-preexec",
  "oldnames": [],
  "one_liner": null,
  "optional_dependencies": [],
  "rank_30d": 1153,
  "rank_365d": 1146,
  "rank_90d": 1203,
  "raw_hash": "cf6e40296486ae30",
  "recommended_dependencies": [],
  "revision": 0,
  "ruby_source_path": "Formula/b/bash-preexec.rb",
  "tap": "homebrew/core",
  "test_dependencies": [],
  "uses_from_macos": [],
  "version_head": "HEAD",
  "version_stable": "0.6.0",
  "versioned_formulae": [],
  "why_use_this": null
}