•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 397,616 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,414 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser:
Views: 1070 | Replies: 4
![]() |
•
•
Join Date: Aug 2007
Posts: 26
Reputation:
Rep Power: 2
Solved Threads: 0
Hello, I need to create a shell script to telnet to a remote server. Perform some action and then exit from that server. I am trying with a dummy script: #!/bin/bash telnet 172.11.11.21 8101<dummy.txt exit The dummy.txt contains the password. The script is not working with the port number. I am getting the following error: 8101: Bad file descriptor Please advice.
Last edited by programmer321 : Jun 25th, 2008 at 4:15 am.
•
•
Join Date: Apr 2008
Posts: 39
Reputation:
Rep Power: 1
Solved Threads: 8
username="myUser"
password=`cat dummy.txt`
# alternatively:
#password=$1
telnet 172.11.11.21 8101 <<EOF
$username
$password
#insert command here
EOF•
•
Join Date: Oct 2007
Posts: 264
Reputation:
Rep Power: 1
Solved Threads: 26
Hey There,
Your results may vary depending on what's running on the port you're connected to. For instance, I don't believe straight-up telnet (port 23) allows for non-interactive here-document scripting. In such instances, you can use other programs like Perl or, probably more easily, Expect to script out a "fake human interaction"
Best wishes,
Mike
Your results may vary depending on what's running on the port you're connected to. For instance, I don't believe straight-up telnet (port 23) allows for non-interactive here-document scripting. In such instances, you can use other programs like Perl or, probably more easily, Expect to script out a "fake human interaction"
Best wishes,
Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
•
•
Join Date: Oct 2007
Posts: 264
Reputation:
Rep Power: 1
Solved Threads: 26
Good deal 
Just for clarity, the point I was trying to make - try that test with port 23 - if you have telnetd running on that machine
I'm glad you're all set !
Best wishes,
Mike

Just for clarity, the point I was trying to make - try that test with port 23 - if you have telnetd running on that machine

I'm glad you're all set !
Best wishes,
Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
ad ad server ad serving advertising architecture backup beta business centro crash daniweb database dell development doubleclick enterprise google hyper-v internet linux longhorn mail microsoft mmorpg news novell open qmail red hat rhel scsi server server 2008 smtp software source suse upgrade vmware windows windows server workspace
- Cannot find server or DNS Error - please help! (Viruses, Spyware and other Nasties)
- Python script to save telnet sesion output in a local file (Python)
- Network access ksh (Shell Scripting)
- Buying a server. (Networking Hardware Configuration)
- System 32 Coming Up at Startup (Viruses, Spyware and other Nasties)
- RedHat Network Server (*nix Hardware Configuration)
- Shuting down Linux Cluster using Telnet (*nix Software)
- 35 processes, need to trim the fat (Viruses, Spyware and other Nasties)
Other Threads in the Shell Scripting Forum
- Previous Thread: Compressing a gzip file (.gz)
- Next Thread: Need some help with compression / move script


Linear Mode