Sponsored Content
Full Discussion: tcl/expect
Top Forums Shell Programming and Scripting tcl/expect Post 302178519 by ramen_noodle on Tuesday 25th of March 2008 06:42:26 PM
Old 03-25-2008
Yes, sorry. I meant what are the expect revisions between sol9 and sol10? Are they identical? More importantly are the tcl/tk installations of the same version between
solaris 9 and 10?

If using a mismatched expect binary with different versions of tcl/tk installed behaviors like this are common. OTOH, it could be a bug in the newer version of expect.

As for how to async handle signals you just install a handler.
Code:
proc waitonchld {} {
     set ret [exp_wait -nowait -i -1]
     puts "Handled child exit $ret"
}
trap -code waitonchld {SIGCHLD}

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

TCL/Expect project questions

I am rewriting the first big script project I ever coded to clean up some issues, mainly my really clumsy bash code, and to migrate to TCL/Expect. I have a couple of questions that I could use some help with. 1.) The script needs to know where it is located. I realize that I could use "find /... (1 Reply)
Discussion started by: thumper
1 Replies

2. Shell Programming and Scripting

Expect with tcl/tk

hai all, i have an tcl script in which i have been reading the DUT Command prompt of an cisco switch as DUT Command Prompt : cisco* and running the test case of stp now the problem is if i have given any blank space in between the cisco or at the startup then the Expect is not identifying the... (0 Replies)
Discussion started by: sanjustudy
0 Replies

3. UNIX for Dummies Questions & Answers

Expect/Tcl help?

Does anyone know of an expect/tcl forum that is as helpful as this one is for shell scripting? Or if anyone has any expect knowledge, can you please provide some guidance on how to write to a local error log based on output from a ssh session? I have something like this: foreach host... (2 Replies)
Discussion started by: earnstaf
2 Replies

4. Shell Programming and Scripting

Tcl expect HELP

In the following "for" loop I assume the the script will expect "anyway", "first" NOT in any paticular order and send "yes" when there found, breaking out of the loop when "$prompt" is found. The way it is working is like 3 individual expect lines, and they MUST be in cronological order. ANY help... (0 Replies)
Discussion started by: dave_m
0 Replies

5. Shell Programming and Scripting

Help with TCL/Expect in Solaris 5.3

I'm having this problem with a very simple tcl expect script that is running on Solaris 5.3 with TCL version 8.4.7 and expect version 5.0. below is the simplified version of the code snippet, which I think has everything to illustrate the problem, the full version is at the very bottom in... (0 Replies)
Discussion started by: pinchharmonic
0 Replies

6. Shell Programming and Scripting

TCL/Expect not working as expected

I am having an issue with TCL\Expect; I am passing arguments via the commandline that are read in via "lrange $argv". One of those var's is a password with characters that need to be escapaed, after escaping them an hitting enter expect is placing curly braces around my password... why?! ... (4 Replies)
Discussion started by: RiSk
4 Replies

7. UNIX for Dummies Questions & Answers

Expect/Tcl help

hi, I am new in Expect. I have a question about expect timeout. suppose I have a structure of expect { ".."{ send"............"} timeout{ ............... } } The silly question is if I reach timeout, how can I store the error message showing on the screen to... (2 Replies)
Discussion started by: allenxiao7
2 Replies

8. Shell Programming and Scripting

expect TCL script

Hello, I write a TCL script for Expect/ Telnet. I want to send command to the telnet server. But I want to close after the command is sent. Anybody know which command can flush the expect so I can sure the command is sent to the telnet server??? EX: send "./command1\r" close... (0 Replies)
Discussion started by: linboco
0 Replies

9. Shell Programming and Scripting

Convert my shell script into expect/tcl

hi experts, how will i convert the first part of my script into expect or tcl since shell script cannot be embedded into expect script ? i have 100+ servers in my serverlist. how will i call or declare it in expect or tcl ? #!/usr/sbin/expect -f serverlist=`cat $1` for i in serverlist... (2 Replies)
Discussion started by: linuxgeek
2 Replies

10. Red Hat

Issue in installing expect and Tcl

Hi I need to install expect in redhat. through net I came to know that I must install tcl too in order to make expect work. I have downloaded both packages but not able to install # ls -lrt total 3720 18:33 tcl8.4.20-src.tar.gz 18:33 expect5.45.3.tar.gz 18:40 expect5.45.3... (7 Replies)
Discussion started by: scriptor
7 Replies
sigtrap(3pm)						 Perl Programmers Reference Guide					      sigtrap(3pm)

NAME
sigtrap - Perl pragma to enable simple signal handling SYNOPSIS
use sigtrap; use sigtrap qw(stack-trace old-interface-signals); # equivalent use sigtrap qw(BUS SEGV PIPE ABRT); use sigtrap qw(die INT QUIT); use sigtrap qw(die normal-signals); use sigtrap qw(die untrapped normal-signals); use sigtrap qw(die untrapped normal-signals stack-trace any error-signals); use sigtrap 'handler' => &my_handler, 'normal-signals'; use sigtrap qw(handler my_handler normal-signals stack-trace error-signals); DESCRIPTION
The sigtrap pragma is a simple interface to installing signal handlers. You can have it install one of two handlers supplied by sigtrap itself (one which provides a Perl stack trace and one which simply "die()"s), or alternately you can supply your own handler for it to install. It can be told only to install a handler for signals which are either untrapped or ignored. It has a couple of lists of signals to trap, plus you can supply your own list of signals. The arguments passed to the "use" statement which invokes sigtrap are processed in order. When a signal name or the name of one of sig- trap's signal lists is encountered a handler is immediately installed, when an option is encountered it affects subsequently installed han- dlers. OPTIONS
SIGNAL HANDLERS These options affect which handler will be used for subsequently installed signals. stack-trace The handler used for subsequently installed signals outputs a Perl stack trace to STDERR and then tries to dump core. This is the default signal handler. die The handler used for subsequently installed signals calls "die" (actually "croak") with a message indicating which signal was caught. handler your-handler your-handler will be used as the handler for subsequently installed signals. your-handler can be any value which is valid as an assignment to an element of %SIG. SIGNAL LISTS sigtrap has a few built-in lists of signals to trap. They are: normal-signals These are the signals which a program might normally expect to encounter and which by default cause it to terminate. They are HUP, INT, PIPE and TERM. error-signals These signals usually indicate a serious problem with the Perl interpreter or with your script. They are ABRT, BUS, EMT, FPE, ILL, QUIT, SEGV, SYS and TRAP. old-interface-signals These are the signals which were trapped by default by the old sigtrap interface, they are ABRT, BUS, EMT, FPE, ILL, PIPE, QUIT, SEGV, SYS, TERM, and TRAP. If no signals or signals lists are passed to sigtrap, this list is used. For each of these three lists, the collection of signals set to be trapped is checked before trapping; if your architecture does not imple- ment a particular signal, it will not be trapped but rather silently ignored. OTHER untrapped This token tells sigtrap to install handlers only for subsequently listed signals which aren't already trapped or ignored. any This token tells sigtrap to install handlers for all subsequently listed signals. This is the default behavior. signal Any argument which looks like a signal name (that is, "/^[A-Z][A-Z0-9]*$/") indicates that sigtrap should install a handler for that name. number Require that at least version number of sigtrap is being used. EXAMPLES
Provide a stack trace for the old-interface-signals: use sigtrap; Ditto: use sigtrap qw(stack-trace old-interface-signals); Provide a stack trace on the 4 listed signals only: use sigtrap qw(BUS SEGV PIPE ABRT); Die on INT or QUIT: use sigtrap qw(die INT QUIT); Die on HUP, INT, PIPE or TERM: use sigtrap qw(die normal-signals); Die on HUP, INT, PIPE or TERM, except don't change the behavior for signals which are already trapped or ignored: use sigtrap qw(die untrapped normal-signals); Die on receipt one of an of the normal-signals which is currently untrapped, provide a stack trace on receipt of any of the error-signals: use sigtrap qw(die untrapped normal-signals stack-trace any error-signals); Install my_handler() as the handler for the normal-signals: use sigtrap 'handler', &my_handler, 'normal-signals'; Install my_handler() as the handler for the normal-signals, provide a Perl stack trace on receipt of one of the error-signals: use sigtrap qw(handler my_handler normal-signals stack-trace error-signals); perl v5.8.0 2002-06-01 sigtrap(3pm)
All times are GMT -4. The time now is 05:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy