From 97fe4b3cfc677928653e80b13ba6070c5e5f57e8 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Wed, 25 Oct 2023 08:28:27 +0200 Subject: Add if-statement around venv prompt --- .bashrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to '.bashrc') diff --git a/.bashrc b/.bashrc index d5f0250..511ae17 100644 --- a/.bashrc +++ b/.bashrc @@ -73,7 +73,10 @@ __precmd() PS1+="\001$SHELLC_F_BLUE\002\w\001$SHELLC_RESET_COLOR_F\002" # Add venv indicator - PS1+="\001$SHELLC_F_CYAN\002#$(awk -F/ '{ print $(NF-1) }' <<< "$PYTHON_VENV_DIR")\001$SHELLC_RESET_COLOR_F\002" + if [[ -n "$PYTHON_VENV_DIR" ]] + then + PS1+="\001$SHELLC_F_CYAN\002#$(awk -F/ '{ print $(NF-1) }' <<< "$PYTHON_VENV_DIR")\001$SHELLC_RESET_COLOR_F\002" + fi # Add git status if git rev-parse --is-inside-work-tree &> /dev/null -- cgit v1.1