目前我有一个“.command”格式的可执行文件。我需要能够在MacOsx终端上运行它,但是当我运行它时,我收到以下错误:
spawn: command not found
couldn't read file "@'s password:": no such file or directory
line 7: send: command not found
couldn't read file "#": no such file or directory
文件“.command”在我执行时正常工作,但它会使用以下消息关闭shh会话: “[已完成处理]”
.command文件的代码:
#!/usr/bin/expect -f
set login "root"
set addr "hostname"
set pw "mypassword"
spawn ssh $login@$addr
expect "$login@$addr's password:"
send "$pw\r"
expect "#"