shell - 创建一个 bash 文件用于通过 tftp 传输文件

标签 shell tftp

我想创建 shell 脚本来调用特定文件的 tftp 传输到我的本地机器

这是我想做的操作

tftp 172.2.22.2
get file1_in_remote location file2_in_local_machine
quit

但我无法让它工作,因为当第一个 tftp 命令执行时,控件将进入 tftp 提示符。它看起来像这样

tftp>

它不会接受我在 shell 脚本中给出的第二个和第三个命令。

但是当我退出 tftp 提示符时,bash 会打印一条错误消息,如

get: command not found
quit: command not found

那么我怎样才能完成它

编辑 1:

tftp 173.32.52.12 -c get MyFile1.txt MyFile2.txt
tftp 173.32.52.12 -c get MyFile1.txt MyFile2.txt MyFile3.txt etc. etc.

这两个命令不适用于我的 ubuntu(14.0.4) 系统

最佳答案

你可以使用 atftp

安装:

sudo apt-get install atftp

使用:

atftp 172.2.22.2 -g -r /remote/file.txt -l /tmp/local.txt

关于shell - 创建一个 bash 文件用于通过 tftp 传输文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36176277/

相关文章:

linux - 如何在不解压缩的情况下列出 zip 存档中的文件?

linux - 创建自定义接受行以测量命令在 zsh 中运行所花费的时间

linux - 通过 tftp 访问符号链接(symbolic link)

c - 插入“^M”字符而不是新行

c++ - TFTP 服务器没有从客户端接收

regex - Bash:用于查找具有双引号的模式的正则表达式

linux - 在 Shell 脚本中打印前一天和后一天的文件路径

linux - 如何在 Unix 中的嵌套循环中读取两个文件

linux - 杀死在子 shell 中运行的 tftp 命令

c - inotify 事件 IN_MODIFY 为 tftp put 发生两次