Jonkman Microblog
  • Login
Show Navigation
  • Public

    • Public
    • Network
    • Groups
    • Popular
    • People

Conversation

Notices

  1. kyzh (kyzh@rage.love)'s status on Monday, 20-Jan-2020 08:06:06 EST kyzh kyzh

    So I have a similar issue to this https://stackoverflow.com/questions/10172860/linux-script-to-parse-telnet-message-and-exit

    I have a bash script
    In that script I need to
    * non interactively connect to TCP port localy.
    * Store the strings that I get as I connect
    * Compare that string with what I expect the answer to be.

    Here is a solution that don't work:

    #!/bin/bash
    VALIDTELNET="parastat vdev"
    # Test telnet
    TELNET=$(echo | nc 127.0.0.1 22196)
    if [[ "$TELNET" == "$VALIDTELNET" ]]
    then
    echo "Telnet Ok" ;
    else
    echo "Telnet connection test failed"
    ERROR=22196
    fi

    --

    I've also used telnet, curl, exec 3<>/dev/tcp/127.0.0.1/22196, etc.

    I either have the string but it is interactive, or the connection stops, but I don't get the strings.

    Note: Why bash, why not X?
    I only want bash, because this is test script and I don't want to install more stuff during the test run.

    Help appreciated :3

    In conversation Monday, 20-Jan-2020 08:06:06 EST from rage.love permalink
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

Jonkman Microblog is a social network, courtesy of SOBAC Microcomputer Services. It runs on GNU social, version 1.2.0-beta5, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All Jonkman Microblog content and data are available under the Creative Commons Attribution 3.0 license.

Switch to desktop site layout.