View the Most Wanted LQ Wiki articles.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 02-20-2004, 01:22 PM   #1
LQ Newbie
Registered: Dec 2003
Location: Orlando, Florida
Distribution: Debian, Fedora
Posts: 8

Rep: Reputation: 0
Space Key in Shell Script

I need my shell script to echo the space key in a telnet session. Here is script as I currently have it:

sleep 2
echo nevermore
sleep 2
echo en
sleep 2
echo chs008
sleep 2
echo "sh run"
sleep 4
echo " "
sleep 4
echo " "
sleep 4
echo " "
sleep 4
echo " "
) | telnet

I am attempting to telnet to a Cisco switch and run the "sh run" command, which fills the screen and you must hit the space key to get the next full screen of data. I am running the script with as follows:

[josh@seraph:~]$ ./telnet.script | tee tee.out

This way I can capture the config of the switch. The script sort of works, but seems that it kills the telnet session when it gets to the second 'echo " " '.

Any help appreciated.

Old 02-20-2004, 01:31 PM   #2
Senior Member
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
Perhaps you should looking into using expect instead. It is widely used for this sort of things, and writing expect scripts is often very straightforward.



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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
Emacs's mark set key(ctrl+space) problem. ayiiq180 Linux - Software 1 06-15-2005 10:45 AM
Delete Key in Shell gh0ul Linux - Newbie 1 10-07-2003 10:58 AM
return key on shell script chupacabra Programming 2 10-22-2002 12:11 PM

All times are GMT -5. The time now is 06:21 AM.

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