[英]Can not enter password in Shell Script
I can not enter my pass word.我无法输入密码。 My shell script is here.
我的 shell 脚本在这里。
#!/bin/bash
expect -c "
set timeout 2
spawn ftp ${HOST}
expect \"Name\(${HOST}:root\):\"
send ${USER}\n
expect \"Password:\"
send ${PASS}\n
interact
"
I can enter user-name, but password is not work....我可以输入用户名,但密码无效....
like this return.像这样的回报。
spawn ftp ******
Connected to ****** (******).
220 (vsFTPd 2.2.2)
Name (******:root): ${USER}
331 Please specify the password.
Password:[root@........ bin]#
I think I send password... Could you please help me?我想我发送密码...你能帮我吗?
Thank you.谢谢你。
SOLVE MY QUESTION解决我的问题
I think it is easy for me to use this.我认为我很容易使用它。
it is easy for me to use this.
#!/bin/sh
SERVER=$1
USER=$2
PASS=$3
FILE=$4
ftp -n <<END
open $SERVER
user $USER $PASS
cd /tmp
binary
prompt
mput $FILE
END
you have to prompt password and send it to variable您必须提示密码并将其发送到变量
echo -n "Enter Password:" read PASS echo -n "输入密码:" 读取 PASS
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.