Need help with executing and deleting remote bash script via a local bash script
- by kenja
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 [email protected]:/usr/home/user/
ssh [email protected]
>sh my_script.sh
>rm myscript.sh
>exit
How do I script the ssh portion of my command list? Thanks!