diff --git a/rc/bash-prompt.sh b/rc/bash-prompt.sh new file mode 100644 index 0000000..967ed5f --- /dev/null +++ b/rc/bash-prompt.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +function get_color() +{ + local color="$1" + echo "\[$(tput setaf "$color")\]" +} + +readonly RED=$(get_color 1) +readonly GREEN=$(get_color 2) +readonly CYAN=$(get_color 6) +readonly END_COLOR='\[\033[00m\]' + +function get_ps1_prompt() +{ + local username='\u' + local hostname='\h' + local working_directory='\w' + local user_type='\$' + + echo "${debian_chroot:+($debian_chroot)}${GREEN}${username}@${hostname}${END_COLOR}:${CYAN}${working_directory}${END_COLOR}${user_type} " +} + +function set_ps1_prompt() +{ + PS1="$(get_ps1_prompt)" + export PS1 +} + +set_ps1_prompt