Hullo,

Responses inline.

--- tuxdna <[EMAIL PROTECTED]> wrote:

> 
> :(){ :|:& };:
>  
> : is a Bash Shell's no-op ( no operation ) literal,
> which can be used
> as 'true' also.

Hmm, I've never heard the character : referred to as
such. Perhaps someone can comment on this, although I
doubt this is the case. IMO, the use of : is just to
obfuscate the fact that its a function name - it could
as easily be a or b or c, or fun.

If that were the case, things would look familiar I'd
expect -

:(){ :|:& };:
fun( { fun|fun& };fun

Declare function fun which calls itself and pipes the
output into another background process. The last
invocation of fun after the ; starts the entire thing.

> [shell]$ :(){ echo "in background"& } 
> works?
> 
> [shell]$ :(){ echo "in background" }  -- NOTE: no
> ampersand( & ) here!

Try it with a semi colon. :(){ echo "foo"; };

In the case without the ; inside - its a background
process, being given as a single command. Its
interpreted the same way you'd write 

$ echo "foo" 

without a ;. But in a for or do loop - you'd need the
; to end the line.

Whats interesting here is how the :|:& is being used -
this exponentially increases the number of processes
spawned! Basically, pipes the output of one : into the
other background process..


Cheers,
Viksit

--
Viksit Gaur           

viksit at aya dot yale dot edu
http://viksit.com

Just because you have a mind like a hammer doesn't mean you should treat 
everyone else like a nail - Terry Pratchett


      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


_______________________________________________
ilugd mailinglist -- ilugd@lists.linux-delhi.org
http://frodo.hserus.net/mailman/listinfo/ilugd
Next Event: http://freed.in - February 22/23, 2008
Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi 
http://www.mail-archive.com/ilugd@lists.linux-delhi.org/

Reply via email to