Linux 如何从脚本创建MacOsx可执行文件

Linux 如何从脚本创建MacOsx可执行文件,linux,bash,macos,shell,ubuntu,Linux,Bash,Macos,Shell,Ubuntu,目前我有一个“.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”时,

目前我有一个“.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 "#"

您需要使用
expect send
,或者将命令放在大括号中……您收到的错误表明是
bash
在执行脚本,而不是
expect