#检查对应的rpm包是否已经安装
LET ls_uname = cl_get_os_type() CASE ls_uname WHEN "LINUX" LET l_ch = base.Channel.create() CALL l_ch.openPipe("rpm - qa|grep '^tcl-'", "r") WHILE l_ch.read(tcl_rpm) LET l_tcl_rpm = l_tcl_rpm,"|",tcl_rpm END WHILE CALL l_ch.openPipe("rpm - qa|grep '^expect-'", "r") WHILE l_ch.read(expect_rpm) LET l_expect_rpm = l_expect_rpm,"|",expect_rpm END WHILE CALL l_ch.close() WHEN "AIX" LET l_ch = base.Channel.create() CALL l_ch.openPipe("rpm - qa|grep '^tcl-'", "r") WHILE l_ch.read(tcl_rpm) LET l_tcl_rpm = l_tcl_rpm,"|",tcl_rpm END WHILE CALL l_ch.openPipe("rpm - qa|grep '^expect-'", "r") WHILE l_ch.read(expect_rpm) LET l_expect_rpm = l_expect_rpm,"|",expect_rpm END WHILE CALL l_ch.close() OTHERWISE CALL cl_err('','azz-948','1') RETURN END CASE IF cl_null(l_tcl_rpm) THEN IF cl_null(l_expect_rpm) THEN CALL cl_err('','azz-954','1') LET g_success = 'N' ELSE CALL cl_err('','azz-952','1') LET g_success = 'N' END IF ELSE IF cl_null(l_expect_rpm) THEN CALL cl_err('','azz-953','1') LET g_success = 'N' END IF END IF 其中 红色部分得值 为Null ,服务器已经安装了tcl,tcl-devel,expect,expect-devel。 执行expect 命令如下 |
|
沙发#
发布于:2017-12-29 18:15
求大神 帮帮忙啦!!
|
|
板凳#
发布于:2017-12-30 08:56
将CALL l_ch.openPipe("rpm - qa|grep '^tcl-'", "r") 替换成CALL l_ch.openPipe("rpm -qa|grep '^tcl-'", "r")
CALL l_ch.openPipe("rpm - qa|grep '^expect-'", "r") 替换成CALL l_ch.openPipe("rpm -qa|grep '^expect-'", "r") 自己在服务器执行rpm -qa|grep '^tcl-' 跟 rpm -qa|grep '^expect-' 看看结果有没有 |
|
地板#
发布于:2017-12-30 14:47
|
|