I want to embed a remote execution command in an SCP
command. Is that possible?
It will save having to execute an SCP
command first, then executing an SSH command on the transferred fiies.
Is this possible?
You might be better doing it the other way around - i.e. transferring the files as part of the ssh session, then executing the cmds as part of the same ssh.
See here : https://unix.stackexchange.com/questions/57807/copy-over-ssh-and-execute-commands-in-one-session
I really don't think scp has the capability you're after but you can 'emulate' the same result over ssh.
Why do you want to avoid running scp followed by ssh? Is it because connecting is slow? If so you might want to try ssh multiplexing:
With multiplexing you can connect once, then any future ssh or scp commands will reuse the existing connection.
Here are some links that explain ssh multiplexing: