Question to gurus with expect

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Question to gurus with expect
# 1  
Old 03-23-2016
Question to gurus with expect

I need to ask question for expect script.
I have prompt like [root@tlvexadb01 orachk]#
and very long script (orachk).
I added to expect script line
set prompt "(%|#|\\\$) $"
and insert into it also piece of code
expect {
    timeout {
        puts "Running..."
    "$prompt" {
        puts "Finished."
        exit 1 

But with no success. When I received desired prompt (as above) script is remain with Running phrase and only after cntr+c combination finishing.
Probably I miss something.
Could anyone help me.,
Thanks and regards, beckss.

Last edited by vbe; 03-23-2016 at 01:02 PM.. Reason: code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Expect Question

I'm using expect to log into a remote host and then execute another script. A log of the script is being created but I can't see to get the script to display while it's running. Any ideas would be appreciated. Here is the script. #!/bin/bash cd /root cat /root/hostname1.txt | while read... (1 Reply)
Discussion started by: jimmyf
1 Replies

2. UNIX for Beginners Questions & Answers

Expect Question

Have an expect script but can't seem to de-bug it. It's stalling at the password prompt. If anyone can see a mistake, kindly let me know. Thanks. Here is the error: spawn ssh -o StrictHostKeyChecking=no user@xx.xx.xx.xx rpm -qa # Warning! You have entered into a secured area! # # All... (2 Replies)
Discussion started by: jimmyf
2 Replies

3. UNIX for Beginners Questions & Answers

Expect question

I have an expect script that appears to be working normally however for some reason, the remote side appears to be stripping off the variables from the awk command. This is the original: expect \"~]$\" send \"sed 's/=/ /g;s/,/ /g' /home/file.txt | grep abc | awk '{print $6,$8}'This is the... (5 Replies)
Discussion started by: jimmyf
5 Replies

4. Shell Programming and Scripting

Question to gurus about sed.

Hi Folks. I need change something into file and after all manipulation I need delete only last COMMA into this piece of code -> GROUP 1 ( '/oralog1/ORAPRD/log01a.dbf', '/oralog2/ORAPRD/log01b.dbf' ) SIZE 512M, GROUP 2 ( '/oralog1/ORAPRD/log02a.dbf', ... (12 Replies)
Discussion started by: beckss
12 Replies

5. Shell Programming and Scripting

two question about expect srcipt

Hi experts, I have two question about expect script questions 1 send "tar -xjvf a.tar\r" send "ifconfig\r" I want to know if it just run "ifconfig after "tar -xjvf a.tar complete. or the two cmd run at the same time question 2 after I use the expect to ssh to the... (1 Reply)
Discussion started by: yanglei_fage
1 Replies

6. Shell Programming and Scripting

Expect question

Hi all, I have got a small expect script like this one. #!/usr/bin/expect -f set timeout 2 spawn ftp $env(IP) match_max 100000 expect -exact "Name" send -- "$env(USER)\n" expect -exact "Password:" send -- "$env(PASSWORD)\n" expect "%" send "bin\r" expect "%" send "prompt\r"... (5 Replies)
Discussion started by: stinkefisch
5 Replies

7. Shell Programming and Scripting

VI Editor - question for unix gurus !!

I have created a dummy file -demo.txt On my machine-A (oslevel-5300-08) I can display the file content in HEX format through VI editor using :%!xxd but on other machine-B (oslevel - 5300-06) , I get error as "sh: xxd: not found." machine-A: $ cat demo.txt Hello World ! I can display... (7 Replies)
Discussion started by: Rahulpict
7 Replies

8. UNIX for Dummies Questions & Answers

expect question

I am trying to write a script that telnets out to multiple ip's, runs some commands exits and the telnets to the next ip. I wrote the following script and it works great until the program hits a nonresponsive ip. I would like this to recognize the ip is bad and move on in the foreach loop. How... (4 Replies)
Discussion started by: pbaets01
4 Replies

9. Shell Programming and Scripting

question regarding EXPECT

I am rather new to using expect and have only written a few scripts using it. I am trying to create a script that will read a file containing a number of hostnames and then for each one: ssh into the box, run a command, scp the output back to a center server. So far I can make all that... (2 Replies)
Discussion started by: finnje
2 Replies
Login or Register to Ask a Question
scotty(1)							 Tnm Tcl Extension							 scotty(1)


scotty - A Tcl shell including the Tnm extensions. SYNOPSIS
scotty ?fileName arg arg ...? _________________________________________________________________ DESCRIPTION
scotty is a Tcl interpreter with extensions to obtain status and configuration information about TCP/IP networks. After startup, scotty evaluates the commands stored in .scottyrc and .tclshrc in the home directory of the user. SCRIPT FILES
If scotty is invoked with arguments then the first argument is the name of a script file and any additional arguments are made available to the script as variables (see below). Instead of reading commands from standard input scotty will read Tcl commands from the named file; scotty will exit when it reaches the end of the file. If you create a Tcl script in a file whose first line is #!/usr/local/bin/scotty2.1.11 then you can invoke the script file directly from your shell if you mark the file as executable. This assumes that scotty has been installed in the default location in /usr/local/bin; if it's installed somewhere else then you'll have to modify the above line to match. Many UNIX systems do not allow the #! line to exceed about 30 characters in length, so be sure that the scotty executable can be accessed with a short file name. An even better approach is to start your script files with the following three lines: #!/bin/sh # the next line restarts using scotty exec scotty2.1.11 "$0" "$@" This approach has three advantages over the approach in the previous paragraph. First, the location of the scotty binary doesn't have to be hard-wired into the script: it can be anywhere in your shell search path. Second, it gets around the 30-character file name limit in the previous approach. Third, this approach will work even if scotty is itself a shell script (this is done on some systems in order to handle multiple architectures or operating systems: the scotty script selects one of several binaries to run). The three lines cause both sh and scotty to process the script, but the exec is only executed by sh. sh processes the script first; it treats the second line as a comment and executes the third line. The exec statement cause the shell to stop processing and instead to start up scotty to reprocess the entire script. When scotty starts up, it treats all three lines as comments, since the backslash at the end of the second line causes the third line to be treated as part of the comment on the second line. VARIABLES
Scotty sets the following Tcl variables: argc Contains a count of the number of arg arguments (0 if none), not including the name of the script file. argv Contains a Tcl list whose elements are the arg arguments, in order, or an empty string if there are no arg arguments. argv0 Contains fileName if it was specified. Otherwise, contains the name by which scotty was invoked. tcl_interactive Contains 1 if scotty is running interactively (no fileName was specified and standard input is a terminal-like device), 0 otherwise. PROMPTS
When scotty is invoked interactively it normally prompts for each command with ``% ''. You can change the prompt by setting the variables tcl_prompt1 and tcl_prompt2. If variable tcl_prompt1 exists then it must consist of a Tcl script to output a prompt; instead of out- putting a prompt scotty will evaluate the script in tcl_prompt1. The variable tcl_prompt2 is used in a similar way when a newline is typed but the current command isn't yet complete; if tcl_prompt2 isn't set then no prompt is output for incomplete commands. SEE ALSO
Tnm(n), Tcl(n) AUTHORS
Juergen Schoenwaelder <> Tnm scotty(1)

Featured Tech Videos