I am trying to figure out how to use fork() with exec(). I read through the perl docs on how it works, but I can't figure out how to implement it.
For example if I wanted to fork a custom sh script:
if (this_condition is true) {
$mypid = fork(); ##?? not sure how this actually works
exec("my_custom.sh > my_custom_output.txt"); ## is this affected by the fork or what do I do?
}
Every example I've seen creates a $mypid = fork(), but I don't know how it actually works and if this is what I'm really wanting to do do.
Thank you!