no screen output


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers no screen output
# 1  
Old 09-17-2006
Question no screen output

I'm a newbie.
I'm having a problem at work with a script. What i'm trying to do is connect to a cisco switch from a sun station. After i run the script and telnet into the switch i don't get any output on the "xterm window" and all my commands from the script don't show up on the screen or on the saved file. If i hit the return on the keyboard those carriage returns show up in the file saved. It's also a pain to get out of the telnet session. Smilie Are my commands not showing up because i'm leaving the sun station and the script connection is lost?
Here's my script:

#!/bin/ksh
telnet $switch_ip $port >saved_file
pause 2 or sleep 2 <---- i don't remember.

#I've typed these below and nothing shows up when the file is saved.
type "type\n"
send "send\n"
sende "sende\n"
print "print\n"
echo "echo\n"
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Screen Output Needed on every execution

Hi , A shell script being executed by multiple user in a host, but i need the output of each user who executed the script user should have screen output as well ...and unique log file name should generated on execution of script is there anyway to get it below file will overwrite... (5 Replies)
Discussion started by: amar1208
5 Replies

2. UNIX for Beginners Questions & Answers

Screen output to a file

Hi All, I am trying to out of shell script when i run it like sh /mypath/abc.sh ....a screen log should be generated whenever i input the values, when above the script prompt for values Regards Amarendra (3 Replies)
Discussion started by: amar1208
3 Replies

3. Shell Programming and Scripting

Screen Output to Specific Columns

User with moderate experience: I run a script (my addiction is KSH) that reads a file and reports certain parameters back to the user on screen and also piped to a file. The file(s) I read is/are located under different directories, and is usually called the same thing. Sometimes not. For... (3 Replies)
Discussion started by: Brusimm
3 Replies

4. Shell Programming and Scripting

Screen output

Is it possible to split the screen and show, lets say a local directory listing on the left and a remote directory listing on the right with shell scripting? I know it's usually done with curses/ncurses, but I'd really like to keep it simple as possible. I guess 'dialog' command could do it... (1 Reply)
Discussion started by: lochraven
1 Replies

5. UNIX for Dummies Questions & Answers

Suppressing output to the screen

I want to check whether the variable read from the console is number or character , so i used echo $option|grep and checked the reuslt returned by grep cmd using $? But since I use echo the value is getting printed in the screen , I want to supress the o/p. Can anyone suggest how this can be... (1 Reply)
Discussion started by: rolex.mp
1 Replies

6. UNIX for Advanced & Expert Users

how to force output to screen??

hi, is there anyway i can force a output of a command to the monitor. for example banner hello > /dev/console it will show a hello in the console, so how do i make it to appear on the monitor screen when the console is been minmize. (6 Replies)
Discussion started by: ckng
6 Replies

7. Shell Programming and Scripting

Turn off Screen Output

Is there a way to turn off standard output while processing is going on? I have tried redirecting to /dev/null but that is not working because some of the commands invoke a profile. I would like to temporarily turn off the screen output until the processing is complete. Sort of like a splash... (3 Replies)
Discussion started by: bestbuyernc
3 Replies

8. Shell Programming and Scripting

screen output

I need to put the following in a script: echo $CCPDB will give me the db name on the screen. I need to use this name to tar cvfEh <newtarname> <dbname.exp>. I am not sure how to use the output that display on the screen in a script. I tried this echo $CCPDB > file didn't work Gundu (1 Reply)
Discussion started by: gundu
1 Replies

9. UNIX for Dummies Questions & Answers

Supress screen output...

I need to suppress the output to the screen. I am appending to a file so do not need the output on the screen in the CLI environment. eg. cat $HOME/somefile >> $HOME/anotherfile I am doing this a number of times with SQL output files so I can look at the finished file not on the screen in the... (3 Replies)
Discussion started by: jagannatha
3 Replies

10. Shell Programming and Scripting

need to hide output to screen

I have a script that askes users to enter in an oracle account and password, The information is displayed on the screen as they type it. Does anyone know how I can hide this output? :confused: (1 Reply)
Discussion started by: boat73
1 Replies
Login or Register to Ask a Question
AUTOEXPECT(1)						      General Commands Manual						     AUTOEXPECT(1)

NAME
autoexpect - generate an Expect script from watching a session SYNOPSIS
autoexpect [ args ] [ program args... ] INTRODUCTION
autoexpect watches you interacting with another program and creates an Expect script that reproduces your interactions. For straightline scripts, autoexpect saves substantial time over writing scripts by hand. Even if you are an Expect expert, you will find it convenient to use autoexpect to automate the more mindless parts of interactions. It is much easier to cut/paste hunks of autoexpect scripts together than to write them from scratch. And if you are a beginner, you may be able to get away with learning nothing more about Expect than how to call autoexpect. The simplest way to use autoexpect is to call it from the command line with no arguments. For example: % autoexpect By default, autoexpect spawns a shell for you. Given a program name and arguments, autoexpect spawns that program. For example: % autoexpect ftp ftp.cme.nist.gov Once your spawned program is running, interact normally. When you have exited the shell (or program that you specified), autoexpect will create a new script for you. By default, autoexpect writes the new script to "script.exp". You can override this with the -f flag fol- lowed by a new script name. The following example runs "ftp ftp.cme.nist.gov" and stores the resulting Expect script in the file "nist". % autoexpect -f nist ftp ftp.cme.nist.gov It is important to understand that autoexpect does not guarantee a working script because it necessarily has to guess about certain things - and occasionally it guesses wrong. However, it is usually very easy to identify and fix these problems. The typical problems are: o Timing. A surprisingly large number of programs (rn, ksh, zsh, telnet, etc.) and devices (e.g., modems) ignore keystrokes that arrive "too quickly" after prompts. If you find your new script hanging up at one spot, try adding a short sleep just before the previous send. You can force this behavior throughout by overriding the variable "force_conservative" near the beginning of the generated script. This "conservative" mode makes autoexpect automatically pause briefly (one tenth of a second) before sending each char- acter. This pacifies every program I know of. This conservative mode is useful if you just want to quickly reassure yourself that the problem is a timing one (or if you really don't care about how fast the script runs). This same mode can be forced before script generation by using the -c flag. Fortunately, these timing spots are rare. For example, telnet ignores characters only after entering its escape sequence. Modems only ignore characters immediately after connecting to them for the first time. A few programs exhibit this behavior all the time but typically have a switch to disable it. For example, rn's -T flag disables this behavior. The following example starts autoexpect in conservative mode. autoexpect -c The -C flag defines a key to toggle conservative mode. The following example starts autoexpect (in non-conservative mode) with ^L as the toggle. (Note that the ^L is entered literally - i.e., enter a real control-L). autoexpect -C ^L The following example starts autoexpect in conservative mode with ^L as the toggle. autoexpect -c -C ^L o Echoing. Many program echo characters. For example, if you type "more" to a shell, what autoexpect actually sees is: you typed 'm', computer typed 'm', you typed 'o', computer typed 'o', you typed 'r', computer typed 'r', ... Without specific knowledge of the program, it is impossible to know if you are waiting to see each character echoed before typ- ing the next. If autoexpect sees characters being echoed, it assumes that it can send them all as a group rather than inter- leaving them the way they originally appeared. This makes the script more pleasant to read. However, it could conceivably be incorrect if you really had to wait to see each character echoed. o Change. Autoexpect records every character from the interaction in the script. This is desirable because it gives you the ability to make judgements about what is important and what can be replaced with a pattern match. On the other hand, if you use commands whose output differs from run to run, the generated scripts are not going to be correct. For example, the "date" command always produces different output. So using the date command while running autoexpect is a sure way to produce a script that will require editing in order for it to work. The -p flag puts autoexpect into "prompt mode". In this mode, autoexpect will only look for the the last line of program output - which is usually the prompt. This handles the date problem (see above) and most others. The following example starts autoexpect in prompt mode. autoexpect -p The -P flag defines a key to toggle prompt mode. The following example starts autoexpect (in non-prompt mode) with ^P as the toggle. Note that the ^P is entered literally - i.e., enter a real control-P. autoexpect -P ^P The following example starts autoexpect in prompt mode with ^P as the toggle. autoexpect -p -P ^P OTHER FLAGS
The -quiet flag disables informational messages produced by autoexpect. The -Q flag names a quote character which can be used to enter characters that autoexpect would otherwise consume because they are used as toggles. The following example shows a number of flags with quote used to provide a way of entering the toggles literally. autoexpect -P ^P -C ^L -Q ^Q STYLE
I don't know if there is a "style" for Expect programs but autoexpect should definitely not be held up as any model of style. For example, autoexpect uses features of Expect that are intended specifically for computer-generated scripting. So don't try to faithfully write scripts that appear as if they were generated by autoexpect. This is not useful. On the other hand, autoexpect scripts do show some worthwhile things. For example, you can see how any string must be quoted in order to use it in a Tcl script simply by running the strings through autoexpect. SEE ALSO
"Exploring Expect: A Tcl-Based Toolkit for Automating Interactive Programs" by Don Libes, O'Reilly and Associates, January 1995. AUTHOR
Don Libes, National Institute of Standards and Technology expect and autoexpect are in the public domain. NIST and I would appreciate credit if these programs or parts of them are used. 30 June 1995 AUTOEXPECT(1)