#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2005
    Posts
    64
    Rep Power
    9

    Help me to write as korn shell script


    Hi..

    This is step to telnet from linux to my window telnet server and run a program called CLISMS.exe. As your information, the program will be sent out a sms to my mobile number. The step as below:-

    Code:
    telnet 123.123.123.123
    Trying 123.123.123.123...
    Connected to 123.123.123.123.
    Escape character is '^]'.
    Welcome to Microsoft Telnet Service
    
    login: ftpadmin
    password:
    
    *===============================================================
    Welcome to Microsoft Telnet Server.
    *===============================================================
    C:\Documents and Settings\ftpadmin>cd \
    C:\>CLISMS.exe /port=1 /to=0133034931 /msg=keke keke
    C:\>exitConnection closed by foreign host.
    The problem is how could i write the steps on korn shell script ?. Please help me..

    I have write the script as below but the program look not executed and i not received the SMS. Why ?
    Code:
    (sleep 1; echo -e "ftpadmin\r"; sleep 1; echo -e "ftpadmin\r"; sleep 1; echo -e "cd \ \r"; sleep 1; echo -e "CLISMS.exe /port=1 /to=0133034931 /msg=keke keke\r"; sleep 5; echo -e "exit\r") | telnet 192.168.2.163
    Thank you,
    baharin
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2007
    Posts
    168
    Rep Power
    7
    Code:
    #!/bin/ksh
    telnet 192.168.2.163 |&
    exec 3>&p 4<&p
    cat - <&4 &
    sleep 1
    echo "ftpadmin" >&3
    sleep 1; 
    echo "ftpadmin" >&3
    sleep 1; 
    echo "cd \"  >&3
    sleep 1; 
    echo "CLISMS.exe /port=1 /to=0133034931 /msg=keke keke" >&3
    sleep 5; 
    echo "exit" >&3
    exec 3>&-
    Also consider using expect

IMN logo majestic logo threadwatch logo seochat tools logo