期待脚本说找不到命令

时间:2016-07-08 17:55:15

标签: expect

我是新手,希望脚本,我想让它自动注册到我们的SCCM。我想知道我的期望剧本有什么问题?

非常感谢!!

#!/usr/bin/expect


## Set all variables
set server "aaa.com"
set username "ad\username"
set pass "password"

## Enroll into SCCM
spawn ./tools/CMEnroll -s $server -ignorecertchainvalidation -u $username
expect "Please enter your password."
send $pass
send \n 
expect "Successfully enrolled"
interact

exit 0

当我打开终端,并使用./expect.sh这个文件时,它说:

sudo: ./expect.sh: command not found

谢谢!

1 个答案:

答案 0 :(得分:0)

您是否在脚本中添加了执行权限?例如,您可以运行:

$ chmod +x expect.sh

chmod +x的解释可在此处找到:https://askubuntu.com/questions/29589/chmod-ux-versus-chmod-x