I want to replace a running tcl script with a bash interpreter. Thetcl script does most of the heavy...
By martin
Hi If someone can help. I am calling "exec tethereal" in TCL WISH todecode a Packet. e.g. /tmp/tmp.c...
By jagdevtur_gmail
Hi All,I am trying to use expect to process debug trace coming in via a comport. I have found that i...
By wookie
I got the idea that it might be easier to have one .dllcontaining my custom cursors and the app'...
By dave_bodenstab
Hi all,for a specific application on Linux I'm starting xterm (exec xterm) andwant the function...
By wolf_grossi, 2 Comments
hello, i need a program to testing if a port is up or down for manyserver.I need to execute commands...
By spremuta_gmail, 4 Comments
Hello,How can I use regexp command and ignore the case ?For example, I would like :example=Example=e...
By hbb, 3 Comments
I'm trying to script an IM using centericq, and I'm trying to do thefollowing and getting ...
By drish, 1 Comments
I want to zip a whole design directory, including all sub-dirs, butwith specific file types excluded...
By niv, 1 Comments
Kimi wrote:
> Hi,
> I understand we have to spawn a process to interact with it using
> expect & send.
> I had been spawing ssh and running several commands in the remote
> machine using send, expect, send, expect...
> Now i am not pretty sure now how i can run the similar command using
> expect in local machine...
> My objecitve is to run serious of command in local machine and get the
> output for that..
> do I have to spawn every command?
> Also... i am trying to run Sql from the expect script, When i tried
> spawing a process using spawn sqlplus -s << EOF it is not
redirection up to a label ( here: EOF) is a shell feature
> recognizing... ( the above command works from command prompt )
> Thanks in advance,
> Kimi
>
Hi,
you have complete scripts for what you want to do?
ssh to the local host! i.e.
set host localhost
instead of
set host remotehost
spawn ssh ${user}...$host
.
or
spawn a shell on your local machine
spawn sh
..
uwe
uweklein | Sat, 10 May 2008 01:09:00 GMT |
Uwe Klein wrote:
> Kimi wrote:
> redirection up to a label ( here: EOF) is a shell feature
>
> Hi,
> you have complete scripts for what you want to do?
> ssh to the local host! i.e.
> set host localhost
> instead of
> set host remotehost
> spawn ssh ${user}...$host
> ..
> or
> spawn a shell on your local machine
> spawn sh
> ...
>
>
> uwe
Hi,
Thanks for the info, the script is huge one... what i have put here is
a piece of code for sql login...
sqlString, storeQuery(1), storeQuery(2), are proper queries...
set sqlString "$dbUserId/$dbpaswd...$dbTnsId\n"
send "sqlplus -s << EOF\r"
expect -re $prompt
send "$sqlString\r"
expect -re $prompt
send "whenever sqlerror exit sql.sqlcode rollback;\r"
expect -re $prompt
send "set feedback off \r"
expect -re $prompt
send "$storeQuery(1)\r"
expect -re $prompt
send "$storeQuery(2)\r"
expect -re $prompt
send "$storeQuery(3)\r"
expect -re $prompt
send "$storeQuery(4)\r"
expect -re $prompt
send "/\r"
expect -re $prompt
send "EOF\r"
expect -re $prompt
set pStruct(DbOutput) $expect_out(buffer)
The above code works well, when i login to remote machine using ssh (
using expect ) and send these commands to remote terminal... But What i
wanted was to execute the above operation from mylocal system without
loggin to remote machine...
ssh to local machine solves the issue, but it will prompt for password
which should not happen ideally...
Please let me know If it is possible to do serious of command execution
in local machine like what we do when we login to remote machine?
can i use spawn sqlplus -s << EOF'? Acutally i am not able to use
like that...
Thanks in advance
Kimi
kimi | Sat, 10 May 2008 01:10:00 GMT |
Kimi wrote:
> Please let me know If it is possible to do serious of command execution
> in local machine like what we do when we login to remote machine?
Skip one "s" replace "ssh" with "sh"
spawn sh
run your expect script as if it is the remote host ommit any login stuff.
> can i use spawn sqlplus -s << EOF'? Acutally i am not able to use
> like that...
As i said before a "here document" is a shell feature not one of spawn or ex
ec.
( do you realy use a here document in an interactive shell?
never got that idea but just checked it works ;-)
> Thanks in advance
> Kimi
>
uwe
uweklein | Sat, 10 May 2008 01:11:00 GMT |
At 2006-10-19 07:48AM, "Uwe Klein" wrote:
> Kimi wrote:
> As i said before a "here document" is a shell feature not one of spawn or exec.[/
color]
I'm not sure about spawn (do you have the Exploring Expect book? If
not, get it), but the exec command can take a string as stdin:
set process_stdin {stdin data for the exec'ed process
goes here
even over
multiple lines
}
set output [exec foo << $process_stdin]
# or
set rc [catch {exec foo << $process_stdin} output]
You could even just put the raw data in braces (or double quotes) as an
argument to exec:
set output [exec foo << {
stdin data for the exec'ed process
goes here
even over
multiple lines
}]
That sacrifices readability, IMO.
Glenn Jackman
Ulterior Designer
glenn_jackman | Sat, 10 May 2008 01:12:00 GMT |
In article <slrnejeunt.3c3.glennj...smeagol.ncf.ca>,
Glenn Jackman <xx087+news...ncf.ca> wrote:
>At 2006-10-19 07:48AM, "Uwe Klein" wrote:
>spawn or exec.
>I'm not sure about spawn (do you have the Exploring Expect book? If
>not, get it), but the exec command can take a string as stdin:
> set process_stdin {stdin data for the exec'ed process
> goes here
> even over
> multiple lines
> }
> set output [exec foo << $process_stdin]
> # or
> set rc [catch {exec foo << $process_stdin} output]
>You could even just put the raw data in braces (or double quotes) as an
>argument to exec:
> set output [exec foo << {
> stdin data for the exec'ed process
> goes here
> even over
> multiple lines
> }]
>That sacrifices readability, IMO.
cameron_laird | Sat, 10 May 2008 01:13:00 GMT |