zoukankan      html  css  js  c++  java
  • 使expect脚本传回返回值

    使expect脚本传回返回值

    1、使用expect示例:

    spawn $SPAWN_CMD

    expect {

            -re "Enter password for new role:" {

                    send "$PWPROMPT\n"

                    exp_continue

            } -re "Enter it again:" {

                    send "$PWPROMPT\n"

                    exp_continue

            } -re "Password(.*)" {

                    send "$PASSWORD\n"

                    exp_continue

            } -re "Password(.*):" {

                    send "$PASSWORD\n"

                    exp_continue

            } eof

    }

    2、返回值

    spawn true

    expect eof

    catch wait result

    exit [lindex $result 3]

    Exits with 0.

    ***

    spawn false

    expect eof

    catch wait result

    exit [lindex $result 3]

    Exits with 1.

    原文

    http://stackoverflow.com/questions/3299502/how-to-return-spawned-process-exit-code-in-expect-script

  • 相关阅读:
    中台之交付
    mysql之事务
    中台之中台的设计
    0318 guava并发工具
    0312 java接口测试三棱军刺rest-assured
    0309 软件基本原理1
    0308 软件系统的非功能需求
    PELT(Per-Entity Load Tracking)
    CPU亲和度
    硬件相关知识随手笔记
  • 原文地址:https://www.cnblogs.com/mydomain/p/3032854.html
Copyright © 2011-2022 走看看