sh脚本except行报错问题

发布时间:2020-07-23 09:40:23 作者:玉骨
来源:网络 阅读:722

脚本内容:

[root@m01 scripts]# cat fenfa_sshkey.exp 

[root@m01 scripts]# cat fenfa_sshkey.exp

#!/usr/bin/expect

if { $argc != 2 } {   

 send_user "usage: expect fenfa_sshkey.exp file host\n"   

 exit   


#define var

set file [lindex $argv 0]

set host [lindex $argv 1]

set password "123456"

spawn ssh-copy-id -i $file " $host"

 expect {

"yes/no"    {send "yes\r";exp_continue}

"*password" {send "$password\r"}

}

expect eof


exit -onexit {

  send_user "Oldboy say good bye to you!\n"

}

执行脚本,报错

sh脚本except行报错问题

[root@m01 scripts]# /bin/sh -x /server/scripts/fenfa_sshkey.exp 

/server/scripts/fenfa_sshkey.exp: line 15: syntax error near unexpected token `}'

/server/scripts/fenfa_sshkey.exp: line 15: `}'

解决办法:

sh脚本except行报错问题

就多了个空格而已,而已,而已

推荐阅读:
  1. tomcat运行控制脚本catalina.sh分析
  2. Oralce 自带创建互信脚本-sshUserSetup.sh

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

shell ce cep

上一篇:平面设计能干什么

下一篇:如何使用Javaweb中的getPart 接收表单文件

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》