diff --git a/bash/bash_prompt.sh b/bash/bash_prompt.sh new file mode 100644 index 0000000..a467c9c --- /dev/null +++ b/bash/bash_prompt.sh @@ -0,0 +1,31 @@ +angle="❯" + +NO_FORMAT="\033[0m" + +C_SEAGREEN2="\033[38;5;83m" +C_INDIANRED1="\033[38;5;203m" +C_GREY89="\033[38;5;254m" + +#If user is root +if [[ "$USER" == "root" ]]; then + char1_col="$C_SEAGREEN2"; + home_col="$C_INDIANRED1"; +else + char1_col="$C_GREY89"; + home_col="$C_SEAGREEN2"; +fi + +#If previous commant was successful +if [[ "$?" -eq "0" ]]; then + char4_col="$C_SEAGREEN2"; +else + char4_col="$C_INDIANRED1"; +fi + +char3_col="$C_SEAGREEN2"; + +dir=$(pwd | sd "$HOME" "$home_col~$NO_FORMAT") + +prompt="$dir" + +echo -e "$dir$char1_col$angle$NO_FORMAT$angle$char3_col$angle$char4_col$angle$NO_FORMAT" \ No newline at end of file