On Thu, Sep 12, 2002 at 05:17:33PM +0530, USM Bish wrote:
> > bash$ :(){ :|:&};:
> >
> > could somebody please enlighten me *before* I run it at the
> > bash prompt ?
> >
>
> Not quite sure, but the expected output will be a "locked" up
> console, which will not accept any further keystrokes ... May
> have to do a 3-finger salute or even a reset drill !
>
> Components here are:
>
> a) The colon ":", which has no effect beyond expanding args
> and performing any specified redirections. In this case a
> null arg state is presented "()".
No. Here, its a function.
The stuff above makes sense if all colons were replaced with "myfunction"
and indented (replacing the semicolon with a newline):
myfunction () {
myfunction | myfunction &
}
myfunction
ie, a function myfunction is defined which calls itself (twice!!) recursively.
And then the function is invoked. Disaster for recipe.
Note that colon is also a shell builtin (which is why Bish got confused),
but functions take precedence.
>From my shell (I removed the actual invocation of the function :-):
binand@binand[~]:(4) :(){ :|:&}
binand@binand[~]:(5) type -a :
: is a function
: ()
{
: | : &
}
: is a shell builtin
Binand
--
If you found this helpful, please take some time off to rate it:
http://svcs.affero.net/rm.php?r=binand
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help