使用SCP bash脚本上传文件


0

我需要bash脚本来上传SCP文件。我如何在脚本中执行此操作,我想从其他程序调用该脚本。 (我知道用EXPECT做到这一点,但我需要简单的bash脚本)。有人可以帮忙吗?


Answers:


2
#!/bin/bash

scp /path/to/source destination.machine.address:/path/to/destination

你想要的是什么?我不完全确定你的问题是什么。充分 scp 可以访问说明 man scp 在你的终端。如果你是从脚本调用它,你可能会想要 设置公钥/私钥认证 所以你不需要输入密码(从调用程序输入密码是可行的,但是一个faff)。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.