I am trying to create a bash script that will scp a script to a remote server, ssh (using an ssh key that is already installed) to the remote server, execute the uploaded script, and then delete the remote script when it is finished. I'm not clear how to run an ssh session inside a bash script. Here are the commands I use to do it from the command line:
scp my_script.sh firstname.lastname@example.org:/usr/home/user/ ssh email@example.com >sh my_script.sh >rm myscript.sh >exit
How do I script the ssh portion of my command list? Thanks!