ENTER for modem configuration via telnet


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ENTER for modem configuration via telnet
# 1  
Old 07-13-2012
ENTER for modem configuration via telnet

Hiya,

I'm trying to write a shell script to enter a bunch of loooooong configuration commands (to set ip, gateway etc.) for a quite outdated modem. It must be accessed via telnet. Here the preliminary code:
Code:
#!/bin/bash          
(echo "open 192.168.1.254"; sleep 10 
echo "Administrator"; sleep 3 
echo "modem command 1"; sleep 2
echo "modem command 2"; sleep 2
 ) | telnet

After the "open" command, I am asked a user name which is "Administrator", upon which I enter the modem terminal and have to put some 20 large commands ("modem command x") followed by ENTER. I can get as far as the modem terminal, but then the script just put the sequence of commands without ENTER:
Code:
Username : Administrator
 {Administrator}=>modem command 1  modem command 2   modem command 3

A solution to a similar problem in this forum suggests to put "\r" in the script to simulate the ENTER key but in my case this would just add a plain "r" to the command line.

I would also be happy about a solution which allows to press the ENTER key manually during sleep time (if I do this now, it would just make a new line...)

I'm a scripting noob and also not too knowledgable about telnet so please bear with me Smilie thx in advance for any hint!

PS. I read about the EXPECT package but it's no option since a want to have a code that runs on various machines without prerequisites.
# 2  
Old 07-13-2012
Try printf "open 192.168.1.254\r\n" ; sleep 10 and the like.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Loop logic, enter into respective IF as per enter input file name

have three big data file, however I just need to see the mentioned below one line form the all the file which has SERVER_CONNECTION Value File 1 export SERVER_CONNECTION=//dvlna002:10001/SmartServer File2 export SERVER_CONNECTION=///SmartServer File3 export... (1 Reply)
Discussion started by: Nsharma3006
1 Replies

2. UNIX for Dummies Questions & Answers

Difference Between Krb5-telnet And Ekrb5-telnet

Hi, I want to know the difference between these two services. Both are under xinetd. Both are used for enabling and disabling Telnet service. So, can somebody please explain me the difference between the two ? Thanks in advance :) (0 Replies)
Discussion started by: kashifsd17
0 Replies

3. Red Hat

Problem in configuration for telnet

hi , every one i wanaa to config tlenet server and did the steps to enable it but when i try to connect to server this error show : telnet : connect to address 10.0.0.100 : No route to host telnet : Unable to connect to remote host : No route to host ... (6 Replies)
Discussion started by: sma88
6 Replies

4. Shell Programming and Scripting

Pressing "Enter/Space bar" using Net::TELNET? in Perl

I'm trying to learn how to get my script to execute the enter button when it telnets into a router and the router displays output but you need to press the space bar or enter button to continue displaying my output of the router. How is this done? (0 Replies)
Discussion started by: xmaverick
0 Replies

5. Shell Programming and Scripting

Using Net::Telnet in Perl to connect to an adsl modem

Hello, First of all, congratulations on this forum! Very mice material! This is my fist thread and it has to do with connecting to an adsl modem and executing some commands. Heres what I do: $username = 'admin'; $passwd = 'admin'; $telnet = new Net::Telnet ( Timeout=>10,... (2 Replies)
Discussion started by: Ravendark
2 Replies

6. Shell Programming and Scripting

Webpage to Telnet via Perl and Expect: Telnet problem?

Somewhat long story: I have a simple Perl CGI script that uses Expect to Telnet to a device and grab some data, and then spits it back to Perl for display on the Webpage. This works for many devices I've tried, but one device just fails, it keeps rejecting the password on this device, only... (1 Reply)
Discussion started by: jondo
1 Replies

7. Linux

modem - usb to serial configuration

I have a serial modem connected to a usb port using an adapter cable. The system is a HP DL360. RedHat ES3.0 I am using the device /dev/ttyUSB0 When I issue the command "mgetty ttyUSB0" I get the following output in the log file. How do I get the system to see the modem. 12/02 14:17:55... (2 Replies)
Discussion started by: jshoovie
2 Replies

8. Solaris

Solaris 9 & USR USB Modem Configuration

Hello There, I just wanted to know if there is any possible configuration for setting up my external USR USB Modem in Solaris 9 (x86). Any help is definitely appreciated. Thanks Khurram Bashir (1 Reply)
Discussion started by: khurram
1 Replies

9. UNIX for Dummies Questions & Answers

Modem - Test /dev/modem

Ok. I tried following the directions from some of the other threads, but I've hit a road block. I have red hat 7.3 and I installed the hcf package: hcfpcimodem-0.99lnxtbeta03042700k2.4.18_3-1rh.i386.rpm It installed ok, no errors, but I still can't get linux to find my modem. I've tried... (2 Replies)
Discussion started by: lawadm1
2 Replies

10. UNIX for Dummies Questions & Answers

Modem problem: "Sorry, modem is busy"

Hi! I have a little prob with dialing up to the internet... When I try connect, it says "Sorry, modem is busy"... Specs: Laptop 56K modem Slackware 8.0 Kernel 2.4.5 Cheers;) (4 Replies)
Discussion started by: satan404
4 Replies
Login or Register to Ask a Question