this post was submitted on 19 Feb 2024
231 points (98.7% liked)

196

16790 readers
3877 users here now

Be sure to follow the rule before you head out.

Rule: You must post before you leave.

^other^ ^rules^

founded 2 years ago
MODERATORS
 

cat imagje

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 25 points 10 months ago (2 children)

Ok but actually what does this do?

[–] [email protected] 50 points 10 months ago* (last edited 10 months ago)

its a lot more readable if you replace the : with any other function name

fork() {
     fork | fork &
};
fork

define a funktion called fork, which calls itself twice (call once, pipe ( "|" ) the result to the same function again which is run in a new thread in the background ( "&" )). Then call the newly defined function. The : is used to make it look more like emoji.