LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-20-2001, 05:23 PM   #1
JustinHoMi
Member
 
Registered: Apr 2001
Location: Raleigh, NC
Distribution: CentOS
Posts: 154

Rep: Reputation: 30
sending telnet commands non-interactively


Howdy. I was wondering if there's a way to send a telnet command, and just get the results back to stdout, so that I can use it in a pipe.

Something like:

telnet x.x.x.x -mycommand | grep somethingelse

Or even just sending the results to a text file would work...

Did I explain myself OK?

Any help would be awesome.

Thanks,
Justin
 
Old 09-21-2001, 08:17 AM   #2
siddiqu
Member
 
Registered: Mar 2001
Location: India
Posts: 332

Rep: Reputation: 30
U can use like this


telnet localhost | (

echo "username"

sleep 3

echo "password"

sleep 2

echo "ping localhost "

sleep 3

echo "exit"
)

write what ever the command u want
siddiqu.T
 
Old 09-21-2001, 12:00 PM   #3
JustinHoMi
Member
 
Registered: Apr 2001
Location: Raleigh, NC
Distribution: CentOS
Posts: 154

Original Poster
Rep: Reputation: 30
nice!!

Thanks a lot!

Justin
 
Old 09-29-2001, 07:05 AM   #4
kris.kj.jacobs
Member
 
Registered: Jun 2001
Location: Belgium
Distribution: Mandrake
Posts: 57

Rep: Reputation: 15
You know Perl ?

You should take a look at the Net::Telnet module. You can setup telnet connection from within a program (= non-interactive). You can send out commands and read the result back.
 
Old 09-29-2001, 01:20 PM   #5
JustinHoMi
Member
 
Registered: Apr 2001
Location: Raleigh, NC
Distribution: CentOS
Posts: 154

Original Poster
Rep: Reputation: 30
No, I don't know perl at all, but I did come across that module a little while back, and installed it. From the readme, and looking at some other scripts that use the telnet module, I managed to write a pretty smooth script that did exactly what I want! =D
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending AT commands to a SMS modem narmida Linux - Hardware 2 09-24-2009 01:05 PM
sending at commands over pppoe? sti2envy Linux - Networking 3 10-18-2005 06:35 AM
serial port (ttyS1) - Sending commands via terminal... HELP!!! Nalorin Linux - Networking 2 08-21-2005 10:22 PM
Sending file using telnet Alien18 Linux - Newbie 3 08-11-2004 11:41 PM
sending windows commands from linux dubman Linux - Networking 1 11-13-2003 07:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration