Can't find the solution.
I need in the script - ssh to a server then change to root via sudo /usr/bin/rootsh -i -u root. Then make some action then go back and carry on with script... Something like
...
ssh -t myserver << EOF
sudo /usr/bin/rootsh -i- -u root
whoami
#<action on myserver as root>
EOF
...
If I do it this way - doesn't work.
If done in the way
ssh -t myserver 'sudo /usr/bin/rootsh -i -u root ;whoami'
I can do ssh and then switch to root, but then script wait until session/shell closed.