I need somehow to exit my script.sh (with return code - would be the best) which runs some other commands and other scripts in the background.

I've tried to run commands via

nohup myInScript.sh &

also I've tried to use at the end of script.sh

disown -a[r]

and also I've tried to kill it

kill $$ 

but the script just hangs after last command and won't quit. How to force it to exit after running its commands? please help.

edit: To be more specific, I'm running the script remotely via ssh on the other machine.

Edit
Report