Using this script you can get a cool bash prompt like this:
You need to use a patched font from Nerd Fonts (or anywhere else).
Check out available colors at https://misc.flogisoft.com/bash/tip_colors_and_formatting
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
show_git_branch() { | |
if [ ! -z "$(parse_git_branch)" ]; then | |
echo -e "\001\033[48;5;8;38;5;4m\002\ue0b0\001\033[0m\002\001\033[0;48;5;8m\002 \uf418 $(parse_git_branch) \001\033[0m\002\001\033[0;38;5;8m\002\ue0b0\001\033[0m\002 " | |
else | |
echo -e "\001\033[38;5;4m\002\ue0b0\001\033[0m\002 " | |
fi | |
} | |
PS1='\[\033[0;48;5;4m\] \w \[\033[0m\]$(show_git_branch)' |
Using this script you can get a cool bash prompt like this:
You need to use a patched font from Nerd Fonts (or anywhere else).
Check out available colors at https://misc.flogisoft.com/bash/tip_colors_and_formatting
awesome thanks
this PS1 is so confusing without variables I recommend making variable