Heyas, just posting because i just finished this.
A kinda of minimalistic approach, as its showing only either a blue $ or a red # which refer to root or user.
The fun part of it is the green happy smiley and the red sad smiley shown at each new prompt, indiciting the success or failure of the last executed comand.
![]()
To install, simply download the script to your homedir and copy paste the code below into an open terminal screen.
Hope you have fun :cool:
EDIT:
Fixed a coloring issue caused by miscoded escape char.
A kinda of minimalistic approach, as its showing only either a blue $ or a red # which refer to root or user.
The fun part of it is the green happy smiley and the red sad smiley shown at each new prompt, indiciting the success or failure of the last executed comand.
Code:
#
# Variables
#
export esc="\033"
export reset="${esc}[0m"
PROMPT_COMMAND='RET=$?;'
RET_VALUE='$(echo $RET)'
#
# Color
#
return_color_uid() {
whitebg="${esc}[47m"
blackbg="${esc}[40m"
redfont="${esc}[31m"
bluefont="${esc}[34m"
greenfont="${esc}[324m"
[ 0 -eq $UID ] && echo "${whitebg}${redfont}" || echo "${whitebg}${bluefont}"
}
export -f return_color_uid
#
# Smiley, from other source
#
RET_SMILEY='$(if [[ $RET = 0 ]]; then echo -ne "\[\033[01;32m\]:)"; else echo -ne "\[\033[01;31m\]:("; fi;)'
#
# PS1
#
export PS1="$RET_SMILEY ${reset}\w $(return_color)\\\$${reset} "
To install, simply download the script to your homedir and copy paste the code below into an open terminal screen.
Code:
echo "source ~/prompt-fun.sh" >> ~/.bashrc
EDIT:
Fixed a coloring issue caused by miscoded escape char.