Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
[root@~]# ./file.sh &
I don't know if $! will terminate if I just log out immediately?
disown the job and it won't. If it's the only thing running in the background, you'd do disown %1. Otherwise it would be the job number given in square brackets when you start the job.
I'm not sure the exact answer to this question.
I do know that to detach from the console requires more than just redirecting to /dev/null. You need to consider using setsid as well as redirecting 1>/dev/null and 2>/dev/null.
Required, but never shown