Scripting 在使用expect时使用命令行参数

Scripting 在使用expect时使用命令行参数,scripting,expect,Scripting,Expect,您好,我正在使用expect将文件输出到远程计算机。我正在将文件名作为命令行参数传递给脚本。但从命令行抛出错误 send -- "mput $1\r" 我的代码如下: set timeout 1000 spawn ftp $ipaddress expect "Name " send -- "$username\r" expect "Password" send -- "$passwd\r" expect "ftp>" send -- "mput $1\r"//error thrown f

您好,我正在使用expect将文件输出到远程计算机。我正在将文件名作为命令行参数传递给脚本。但从命令行抛出错误

send -- "mput $1\r"
我的代码如下:

set timeout 1000
spawn ftp $ipaddress
expect "Name "
send -- "$username\r"
expect "Password"
send -- "$passwd\r"
expect "ftp>"
send -- "mput $1\r"//error thrown from this line
expect "mput $1? "
send -- "y\r"
expect "ftp>"
send -- "bye\r"

有人能告诉我这里出了什么问题吗?

[lindex$argv 0]
替换
$1
$argc
变量告诉给定参数的数量