I'm trying to create a shell script which will execute some commands which I require frequently. I made the ssh login to skip the password prompt using a public/private key pair. and after some search, I'm able to execute some codes like:
ssh -X email@example.com << EOF cd /root/myDir gedit a.c b.c EOF
But I don't see any difference if I put like:
ssh -X firstname.lastname@example.org << EOF cd /root/myDir gedit a.c b.c & EOF
& doesn't make any difference.With
&, generally after executing gedit, it'll be sent to background and prompt will come. But I'm not getting the prompt after gedit. (Though whatever there in the next line is getting executed. Like if I put
echo "Hello", it's displaying
What's wrong here? Is there any other method? I want to do a SSH and execute some command through shell script. But I don't want to logout after the shell script finishes its execution. I want to logout manually after executing some of my own commands which are not repetitive like the above script.