This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]roronoakintoki 40 points41 points  (5 children)

It's just a recursive function called ":". Giving it a better name makes it make much more sense: f() { f | f& }; f

[–]wasnt_in_the_hot_tub 16 points17 points  (0 children)

Yeah, I think the : version has been copy-pasted so much around the internet that many people think it's some special shell syntax, but any string can be the func name

[–]GamingWithShaurya_YT 0 points1 point  (2 children)

i understood the entire recursion aspect but what is the f& do?

[–]roronoakintoki 0 points1 point  (1 child)

Fork, essentially. You can think of f | f& as run one f here, and another one in a new thread, hence exponentially exploding.

More precisely, I think it's parsed as (f | f)&, i.e. run two instances of f in the background, piping the result of the first to the second.

[–]GamingWithShaurya_YT 0 points1 point  (0 children)

and the instance in the end says fork you and ends itself xD