Fix path in prompt

This commit is contained in:
Gender Demon 2022-10-07 14:39:42 +01:00
parent abfcee1473
commit e4070d5ef9
1 changed files with 13 additions and 16 deletions

29
mkshrc
View File

@ -8,22 +8,19 @@ alias gcc="gcc -Wall"
bind ^L=clear-screen
# Prompt
# Prompt functions
get_username() {
print $(id -un)
}
get_hostname() {
print $(hostname)
}
get_cwd() {
# substitute $HOME string in $PWD with ~
# (so for example /home/cren/config becomes ~/config)
print ${PWD/$HOME/~}
}
# Prompt colour strings. To save typing them out every time I want to use them!
# TODO
export text_black=''
export text_red=''
export text_green=''
export text_brown=''
export text_blue=''
export text_purple=''
export text_cyan=''
export text_white=''
export end_format=''
PS1='$(get_username)@$(get_hostname) $(get_cwd) % '
# PS1="${text_brown}$(get_username)@$(get_hostname)${end_format} $(get_cwd) % "
# PS1="^[31m${USER:=$(id -un)}""@${HOSTNAME:=$(hostname)} "\$PWD" % "
# PS1="hi"
PS1="${text_brown}${USER:=$(id -un)}@${HOSTNAME:=$(hostname)}${end_format} \${PWD/\/home\/cren/\~} % "