I have a shell script that executes on remote server through ssh. It needs to execute Ctrl+Z and background the shell session to temporarily be back to my local terminal.
I tried for the following commands. (Current shell's pid in $$)
kill -s STOP $$
killall -s STOP $$
kill -s TSTP $$
killall -s TSTP $$
However, none of them worked as expected as follows:
Command 1, 2, 3:
Successfully suspended the session, but I could do nothing afterwards as command prompt wasn't appeared again.
Didn't seem to suspend session, but command prompt was appeared after execution.
Is there any way to work it out?