I am already connected to a remote server using ssh with running the following command
ssh user@ip
and connected to that server and I am in that server terminal now.
I want to execute a script exist on my loca machine on the remote server while I am connecting to it.
I know that there is another way to do that by doing something like this
ssh serverA "bash -s" -- < ./ex.bash
but my case is different, I want to execute the script after connecting to the server
how can I do that?
Without a shared volume, like via NFS, you can't do it. If it's a simple script then you can
scp /some/ex.bash remote:/tmp/ex.bashand then when you ssh toremoteyou can run/tmp/ex.bash.Setting up NFS is more involved than an SO answer. See something like: https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nfs-mount-on-ubuntu-20-04