如何使用linux中的shell脚本登录ftp srever? [英] How to login to an ftp srever using shell scripting in linux?
本文介绍了如何使用linux中的shell脚本登录ftp srever?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用shell脚本登录到我的FTP服务器。我制作了一个.sh文件,其内容为
i want to login to my FTP server using shell scripting. I made a .sh file having contents as
ftp
打开172.31.1.45
ftp open 172.31.1.45
不工作。第二个命令未执行。请帮忙。我是新的linux所以请原谅这是一个愚蠢的问题
but its not working. The second command is not executing. Please help. I am new to linux so please forgive is this is a stupid question
推荐答案
试试这个:
#!/bin/sh
HOST="yourhost"
USER="user"
PASSWD="pass"
FILE="file.txt"
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
put $FILE
quit
END_SCRIPT
这篇关于如何使用linux中的shell脚本登录ftp srever?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文