I'm running a shell script we'll call parent that has a loop. Each iteration in the loop executes something else we'll call child, and when that completes (synchronous/blocking), my script goes to the next iteration.

Is there a way in linux to detach child from the parent process, and then kill parent while leaving the current child to complete normally?

(I think next time I'll include a check inside my loop for the existence of a stop file, and if the file is present, I'll break out of the loop instead of launching the next child. But seeing as the parent that's currently running doesn't have that logic, is there still a way for me to accomplish what I want at the command line?)

New contributor
user3735178 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

user3735178 is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.