31 lines
579 B
Bash
31 lines
579 B
Bash
#!/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
|