I was trying the following combination in order to get the pid of the ssh session (running in the background displays the pid) and than fg to get back to the ssh session and introduce the password:
ssh targetHost &; fg
I get the following error:
-bash: syntax error near unexpected token `;'
Why does the ";" not work to as expected in this case?
My aim is to start a ssh session and know its pid and I need to do this in as few lines as possible. I need to start several ssh sessions, put them in the background and at the end kill them - that's why I need the pids.