input/minput commands - Protocols

This is a discussion on input/minput commands - Protocols ; Is there a way to get the input/minput command to find an exact match? I want it to find only the string: login: That's a single space followed by login: and no trailing spaces. Using the UNIX grep command I ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: input/minput commands

  1. input/minput commands

    Is there a way to get the input/minput command to find an exact match?

    I want it to find only the string:

    login:

    That's a single space followed by login: and no trailing spaces. Using
    the UNIX grep command I would find it using:

    grep '^ login:$' file_name

    Instead, input/minput is catching any line with login: within it, such
    as:

    Last login: Tue Aug 17 16:03:20 from 10.195.10.8


    Thanks
    --
    +-----------------+----------------------------------+------------------------+
    | . . |Kenny Broezell |phone 847) 342-5633|
    | ... ... |Customer Network Resolution Center|alt phone847) 632-5390|
    | ..... ..... |1501 Shure Drive |fax 847) 632-3157|

  2. Re: input/minput commands

    On 2004-08-25, Ken V. Broezell {QMCS11} wrote:
    : Is there a way to get the input/minput command to find an exact match?
    :
    : I want it to find only the string:
    :
    : login:
    :
    : That's a single space followed by login: and no trailing spaces. Using
    : the UNIX grep command I would find it using:
    :
    : grep '^ login:$' file_name
    :
    : Instead, input/minput is catching any line with login: within it, such as:
    :
    : Last login: Tue Aug 17 16:03:20 from 10.195.10.8
    :
    The grep-like pattern mentioned in a previous response to this posting might
    do the job, but to be perfectly accurate and precise, you have to take time
    into account. What you probably should be looking for is a carriage return,
    a linefeed, a space, the string "login:" (or maybe it should be "login: "?),
    and then check that nothing else follows within a certain amount of time.
    You could do it like this:

    input 20 "\13\10 login:"
    if failure { (handle failure) }
    input 5
    if success { (handle failure) }
    (handle success)

    "input 5" means "wait up to 5 seconds for any character to arrive". Thus
    if it succeeds, you do not have the login prompt you were looking for.

    - Frank

+ Reply to Thread