Re: How to catch erro from spawned command?
- From: eric5931@xxxxxxxxx
- Date: Mon, 14 Apr 2008 14:25:45 -0700 (PDT)
Sorry I hit the wrong key and the message just got sent. Here is a
rewrite:
I have a problem with this in expect:
spawn ssh f...@xxxxxxxxxxxxxxx ls -l > /tmp/mylog 2>&1
while (1) {
expect timeout { puts "get timeout\n"; exit 99} \
"Are you sure*" { send "no\r"; break; } \
"*password: $" { send "$passwd\r"; continue; } \
eof { puts "get eof\n"; break;} \
default { puts "get default\n"; break;};
}
The problem is if "ssh" failed, like the script get a dummy ip
address, the erro message, "ssh: connect to host 123.123.123.123 port
22: No route to host" didn't get to /tmp/mylog. This is because
expect think my command is
'spawn ssh f...@xxxxxxxxxxxxxxx "ls -l > /tmp/mylog 2>&1" '
but what I really want is
'spawn "ssh f...@xxxxxxxxxxxxxxx ls -l" > /tmp/mylog 2>&1 '
so I can catch the ssh error.
How should I correct tghe command syntax?
Eric.
.
- Follow-Ups:
- Re: How to catch erro from spawned command?
- From: Bezoar
- Re: How to catch erro from spawned command?
- From: Bruce Hartweg
- Re: How to catch erro from spawned command?
- Prev by Date: Re: ANNOUNCE: TclOO 0.2 Released
- Next by Date: Re: TLS bug: empty reads
- Previous by thread: use specified number of "characters" during format print
- Next by thread: Re: How to catch erro from spawned command?
- Index(es):
Relevant Pages
|
|