I'd like to execute multiple commands through ssh from the script on my local machine, but without the need to recoect for each command. Normally, I'd go with something like:
$ ssh [user]@[server] '[command 1] | [command 2] | [command 3]'
However this strips me of the opportunity to know the output and exit code of each command. What I'd really like to do is have ssh coection hang on somewhere in the background and then just feed it commands and receive output from it, for example (this is not valid, obviously, just an example of what I'd like it to look like):
$ ssh --name=my_coection [user]@[server]
$ ssh my_coection 'command_1'
$ ssh my_coection 'command_2'
$ ssh my_coection 'command_3'
Is it possible in any way?
برچسب:
نویسنده: استخدام کار