Set PS1 prompt

This commit is contained in:
Martin Blazik
2024-03-15 10:46:47 +01:00
parent d2542f38eb
commit bcf859bb1e

30
rc/bash-prompt.sh Normal file
View File

@@ -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