很抱歉提出这样一个普遍的问题,但这已经困扰了我好几天.
一位朋友给了我这段代码(?)并且不会告诉我它的作用,或者即使它是C或bash或其他任何东西.
从它的外观来看,它看起来像C给我.虽然我不明白为什么有:这方面.
:(){:|:&};:
Run Code Online (Sandbox Code Playgroud)
任何线索将不胜感激.
SLa*_*aks 25
这是bash shell脚本,而不是C.
这是一个叉炸弹.
维基百科解释说:
:() # define ':' -- whenever we say ':', do this:
{ # beginning of what to do when we say ':'
: # load another copy of the ':' function into memory...
| # ...and pipe its output to...
: # ...another copy of ':' function, which has to be loaded into memory
# (therefore, ':|:' simply gets two copies of ':' loaded whenever ':' is called)
& # disown the functions -- if the first ':' is killed,
# all of the functions that it has started should NOT be auto-killed
} # end of what to do when we say ':'
; # Having defined ':', we should now...
: # ...call ':', initiating a chain-reaction: each ':' will start two more.
Run Code Online (Sandbox Code Playgroud)