[英]Shell script - SSH
I am using shell script to add some file to server. 我正在使用Shell脚本向服务器添加一些文件。 Is there any way to write a shell script that will execute one part on local computer and the other part when you're logged into that server?
有什么方法可以编写一个Shell脚本,该脚本将在本地计算机上执行一部分,而在您登录该服务器时执行另一部分?
For example, I want to log in, do something, add some file, and then I want to list everything on that server. 例如,我要登录,执行某些操作,添加一些文件,然后再列出该服务器上的所有内容。
ssh something@something ssh something @ something
I enter password 我输入密码
Then list files from server. 然后列出服务器中的文件。
You can just add a command to end of the ssh command; 您只需在ssh命令的末尾添加一个命令即可。 for example:
例如:
ssh username@host ls
will run ls
on the server, instead of giving you a login shell. 将在服务器上运行
ls
,而不是为您提供登录shell。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.