码迷,mamicode.com
首页 > 系统相关 > 详细

expect 切换用户后自动执行shell命令

时间:2016-06-08 18:36:24      阅读:711      评论:0      收藏:0      [点我收藏+]

标签:

#!/usr/bin/expect -f
set tvgwRecordChannel [lindex $argv 0]
set tvldFlag [lindex $argv 1]
spawn su
expect "Password: "
send "hello123\r"
expect "]#"
send "./cmm_tvgw_config.sh  $tvgwRecordChannel  $tvldFlag\r"
expect "]#"
send "/opt/fonsview/NE/cmm/bin/restart.sh\r"
expect eof

expect 切换用户后自动执行shell命令

标签:

原文地址:http://www.cnblogs.com/rspb/p/5570750.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!