A script for Git-aware customization of the command prompt in Bash and zsh
![](https://www.deeplearningdaily.com/wp-content/uploads/2021/06/a-script-for-git-aware-customization-of-the-command-prompt-in-bash-and-zsh_60baa4b4173bd-375x210.jpeg)
ps1.py
Here we have yet another script for Git-aware customization of the command prompt in Bash and zsh. Unlike all the other scripts, I wrote this one, so it’s better.
Features:
- lets you know if you have mail in
$MAIL
- shows chroot and virtualenv prompt prefixes
- automatically truncates the current directory path if it gets too long
- shows the status of the current Git repository (see below)
- thoroughly documented and easily customizable
- supports both Bash and zsh
- can optionally output just the Git status, in case you want to combine it with your own prompt string
Requirements
- Python 3, version 3.5 or higher
- Git, version 1.7.10 or higher
- bash or zsh
Installation & Setup
-
Save ps1.py to your