:) oscar:~#
Happy face! And in case of an error, it looks sad.:( 2 oscar:~#
Cute, a? It even prints the exit code. Useful and cute at the same time! And here is definition of the prompt. As you can see it uses simple function to determine return code of executed command and adjust its feelings accordingly.smiley() {
RC=$?
[[ ${RC} == 0 ]] && echo ':)' || echo ":( ${RC}"
}
export PS1="\$(smiley) \u@\h:\w\\$ "
For more adventurous people, maybe this prompt would be more interesting.
export PS1="\[\033[0;36m\]\033(0l\033(B\[\033[0m\][\[\033[1;31m\]\u\[\033[0m\]]\[\033[0;36m\]\033(0q\033(B\[\033[0m\][\[\033[1;33m\]@\h\[\033[0m\]]\[\033[0;36m\]\033(0q\033(B\[\033[0m\][\[\033[0;37m\]\T\[\033[0m\]]\[\033[0;36m\]\033(0q\033(B\033(0q\033(B\033(0q\033(B\033(0q\033(B\033(0q\033(B\033(0q\033(B\033(0q\033(B\033(0q\033(B\[\033[0m\][\[\033[1;33m\]\w\[\033[0m\]]\n\[\033[0;36m\]\033(0m\033(B\[\033[0m\]\$ "
Magic! :)What is your favorite prompt? Please leave boring \u@\h:\w for dinner with your parents. :P
I have something which looks like this:
– user@host :) [~] –
=>
(Yes, a two-line prompt, as the second line is always just that arrow, and so you’re always looking at the same place to type.)
Do you really want the code for it? It has colours and everything (including red for a frowny when the exit code is non-zero ;) and it’s about 60 lines…
Excessive? Perhaps…
OMG, that’s a lot of code for one prompt. :) If it’s not a problem, you could include the code here. I would be very interested to see it. :)