如何将LINUX本地的文件内容写入到远程服务器的文件中

服务器之间最好ssh免密码登录,如果不是免密码登录,每次写入都要手敲密码。

------------将本地的test.log文件的内容写入到远程服务器test1.log文件中。

脚本内容:

#!bin/bash

ssh [email protected] 'cat /opt/test.log >> /opt/test1.log'


-------------将远程服务器test1.log文件中的内容写入到本地的test.log文件中。

脚本内容:

#!bin/bash

ssh [email protected] 'cat /opt/test.log' >> /opt/test1.log



猜你喜欢

转载自blog.csdn.net/cp_panda_5/article/details/79757562