如何执行shell脚本?

时间:2017-08-11 05:04:55

标签: linux bash shell sh

如何执行shell scipt?

当我使用:

运行脚本时
jalaj@jalaj-SVF14212SNB sudo ./startvpn.sh  
[sudo] password for jalaj: 
sudo: unable to execute ./startvpn.sh: Permission denied //It says

当我使用时执行此操作     sudo sh startvpn.sh     jalaj的[sudo]密码:

I get the output as 

startvpn.sh: 2: startvpn.sh: spawn: not found
startvpn.sh: 3: startvpn.sh: expect: not found
startvpn.sh: 4: startvpn.sh: expect: not found
startvpn.sh: 5: startvpn.sh: interact: not found

以下是我的剧本

#!/usr/bin/expect 
spawn openconnect --no-cert-check 103.194.44.2
expect -exact "Username:"send -- "XYX\n"
expect -exact "Password:"send -- "XYX%"
interact

我使用

检查了上述权限
-rwxrw---x 1 jalaj jalaj 168 Aug 10 12:29 startvpn.sh

它说用户jalaj可以执行,但我无法执行 任何人都可以指导我如何执行脚本吗?

0 个答案:

没有答案
相关问题