Set PS1 prompt
This commit is contained in:
30
rc/bash-prompt.sh
Normal file
30
rc/bash-prompt.sh
Normal 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
|
||||
Reference in New Issue
Block a user