Smiley Face Bash Prompt

PS1="\`if [ \$? = 0 ]; then echo \e[33\;40m\\\^\\\_\\\^\e[0m; else echo \e[36\;40m\\\-\e[0m\\\_\e[36\;40m\\\-\e[0m; fi\` \u \w:\h)"
If your last command was a dud, your bash prompt will be angry at you. Otherwise it's happy. Soon you will crave its constant approval and your linux skills will improve simply to avoid low self-esteem.
Sample Output
^_^ # true
^_^ # false
-_- #

18
2009-06-30 14:29:55

What Others Think

haha! love it!
nottings · 604 weeks and 1 day ago
Very good. Is not for men?
point_to_null · 604 weeks and 1 day ago
a bit emo, but very amusing!
irae · 604 weeks and 1 day ago
it is a very fun command. However, the open colors screw with the ability of (at least gnome-terminal) wrapping text to the next line. Be sure to open and close around each color set to fix this. example: \[\e[36\;40m\]. and when setting back to defaults, leave the semicolon outside. example: \[\e[0m\];
random_bob · 603 weeks and 6 days ago
Thanks. Now, my prompt has officially been rendered unreadable ;-) PS1="\[\033[0;33m\]\[email protected]\h\[\033[0m\]:\[\033[0;36m\]\A\[\033[0m\]:\`if [ \$? = 0 ]; then echo \e[33\;40m\\\^\\\_\\\^\e[0m; else echo \e[36\;40m\\\-\e[0m\\\_\e[36\;40m\\\-\e[0m; fi\`:\[\033[1;34m\]\w\[\033[0m\]>\[\033[0m\] "
Alanceil · 603 weeks and 6 days ago
"Edit": Cleaned up edition with less escapes and a transparent background for the smiley (instead of black): PS1="\033[0;32m\[email protected]\h\033[0m:\033[0;36m\A\033[0m:\`if [ \$? = 0 ]; then echo '\033[1;30m^_^\033[0m'; else echo '\033[0;33m>_>\033[0m' ; fi\`:\033[1;34m\w\033[0m>\033[0m "
Alanceil · 603 weeks and 6 days ago
I went along the same lines, but closed the color codes; PS1="\`if [ \$? = 0 ]; then echo \[\e[34m\]^_^\[\e[0m\]; else echo \[\e[31m\]O_O\[\e[0m\]; fi\`[\[email protected]\h:\w]\\$ " this way it handles text wrap for long commands (like this one)
random_bob · 603 weeks and 2 days ago
Here are some more advanced prompts: http://www.askapache.com/linux/bash-power-prompt.html
AskApache · 226 weeks and 3 days ago
Can't get it. Just want to know the Best NFL players to pick for fantasy football
paultribbiani · 22 weeks and 5 days ago
I can set up my new idea from this post. It gives in depth information. Thanks for this valuable information for all,.. Click here
bojokey283 · 4 weeks and 4 days ago
Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts. instagram Abonnenten kaufen bei abonnenten24.de
bojokey283 · 3 weeks and 4 days ago
I am very enjoyed for this blog. Its an informative topic. It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy. Domótica
bojokey283 · 3 weeks and 3 days ago
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!.. digital marketing
bojokey283 · 3 weeks and 2 days ago
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. alquiler de carros en cartagena
bojokey283 · 1 week and 4 days ago
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!.. bridgend house clearance
bojokey283 · 1 week and 3 days ago
Very nice article, I enjoyed reading your post, very nice share, I want to twit this to my followers. Thanks!. hartlepool removals
bojokey283 · 1 week and 3 days ago
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. Heimautomation
bojokey283 · 1 week ago
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!.. tree surgeon in colchester
bojokey283 · 1 week ago
Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.. covid isla mujeres
bojokey283 · 4 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: