[TAG] Just Bad and Wrong... yet cool

Jimmy O'Regan jimregan at o2.ie
Sat Oct 15 03:20:46 MSD 2005


Benjamin A. Okopnik wrote:
> On Fri, Oct 14, 2005 at 11:32:06AM +0100, Jimmy O'Regan wrote:
> 
>>Raj shekhar wrote:
>>
>>>in infinite wisdom Jimmy O'Regan spoke thus on 10/14/05 06:09:
>>>
>>>
>>>>Rick Moen wrote:
>>>>
>>>>
>>>>>"bash is terrifying me again":
>>>>>http://www.livejournal.com/users/mendel/128965.html
>>>>>
>>>>>Bash pseudo-sockets:  Oh my!
>>>>>
>>>>>followed by:
>>>>>"Dude, you've got a smiley in your prompt."
>>>>
>>>>
>>>>
>>>>Followed by:
>>>>
>>>>:) fishsticks$ false
>>>>:( fishsticks$
>>>
>>>
>>>How did he do that.  I want something like that too.  If anyone knows, 
>>>do tell.
>>>
>>
>>``
>>jimregan at jimmy ~
>>$ echo $PS1
>>\[\033]0;\w\007 \033[32m\]\u@\h \[\033[33m\w\033[0m\] $
>>
>>jimregan at jimmy ~
>>$ smiley () { if [ $? == 0 ]; then echo ':)';else echo ':(';fi; }
>>
>>jimregan at jimmy ~
>>$ PS1="\$(smiley) \h$ "
>>:) jimmy$ false
>>:( jimmy$ true
>>:) jimmy$
>>''
> 
> 
> Darn it, Jimmy, you always beat me. What, you have a fast connection or
> something? :)

My connection, in "the cheque is in the mail" speed is 115.2 Kbps, so no.

> 
> My way was just slightly different:
> 
> ``
> # More-or-less undocumented Bash-ism - a C-style trinary operator
> smiley () { echo -e ":\\$(($??50:51))"; }
> ''

Ooh! Nifty.





More information about the TAG mailing list