Free Republic
Browse · Search
News/Activism
Topics · Post Article

To: Senator Bedfellow
Damn slashdotters ;)

Ya, /. is a PITA sometimes, but it is occasionally useful. I actually found my bash prompt in a comment on /. quite a while back...

 :) echo $PS1
\w `if [ $? = 0 ]; then echo :\\); else echo :\\(; fi`

What that will do is make your prompt into a smiley :) if the last command was successful (i.e., $? is 0). If it is anything but 0, you see a frowney :(

Pretty cool and useful IMO.

16 posted on 05/12/2006 10:27:08 AM PDT by zeugma (Come to the Dark Side... We have cookies!)
[ Post Reply | Private Reply | To 15 | View Replies ]


To: zeugma

LOL - very clever. But don't go over there today - today's designated lefty trollfest is a giant thread on this NSA thing ;)


17 posted on 05/12/2006 10:51:51 AM PDT by Senator Bedfellow
[ Post Reply | Private Reply | To 16 | View Replies ]

To: zeugma

does that line go in the user's .bash_profile?


18 posted on 05/12/2006 12:32:59 PM PDT by ShadowAce (Linux -- The Ultimate Windows Service Pack)
[ Post Reply | Private Reply | To 16 | View Replies ]

To: zeugma
Zeg,

That is a *great* idea! I might implement something like that for the default prompt on my systems at the office..
24 posted on 05/14/2006 11:46:58 AM PDT by N3WBI3 ("I can kill you with my brain" - River Tam)
[ Post Reply | Private Reply | To 16 | View Replies ]

To: zeugma
I've been using a variation of your prompt since we had this discussion 14 years ago. Here's te relevant portion of my .bashrc :

GREEN='\[\033[32m\]'
RED='\[\033[31m\]'
NC='\[\033[37m\]'

PS1="\u@\w \`if [ \$? = 0 ]; then echo ${GREEN}:\\\)${NC}; else echo ${RED}:\\\(${NC}; fi\`"

The above gives me a green smiley if the command is successful, and a red frowney if it is not. Pretty handy.

26 posted on 01/21/2021 5:45:25 AM PST by ShadowAce (Linux - The Ultimate Windows Service Pack )
[ Post Reply | Private Reply | To 16 | View Replies ]

Free Republic
Browse · Search
News/Activism
Topics · Post Article


FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson