expect: does "if [[ $FILE =~ ^[A-F0-9]{32}[.][A-F0-9]{8}[.]jpg$ ]]; then\n> " (spawn_id exp6) match glob pattern "if [[ $FILE =~ ^[A-F0-9]{32}[.][A-F0-9]{8}[.]jpg$ ]]; then\n> "? no
expect: timed out
Why can't I match any if commands? What's so different about them? Every line I have with if...
Hi,
I'm sending a bash command to a linux machine but the input buffer is somehow getting a "\n" inserted into it so I can't match. I can't figure out why and it's driving me crazy. Any ideas where it's comming from? you can see it right after the "img_2".
send: sending "rmdir...
Also tried with one square bracket:
expect: does " if [ -d emptyfolder1319668531 ]\n> " (spawn_id exp4) match glob pattern " if [ -d emptyfolder1319668531 ]\n> "? no
expect: timed out
Tried again without the quotes but still fails.
expect: does " if [[ -d emptyfolder1319666737 ]]\n> " (spawn_id exp4) match glob pattern " if [[ -d emptyfolder1319666737 ]]\n> "? no
expect: timed out
I'm sending some bash commands to run on the Linux command line of the target machine, but I can't figure out why this code fails? Any ideas?
expect: does " if [[ -d "emptyfolder1319665962" ]]\n> " (spawn_id exp4) match glob pattern " if [[ -d "emptyfolder1319665962" ]]\n> "? no
expect...
Thanks,
I did something similar with a boolean variable and having the procedure check it like you did but you can't break out of it until you get to a point where you can check the variable right? Instead of doing a "puts" it may be a procedure processing lots of files in a directory and I...
Let's say I have a Tk GUI app that's running a procedure that takes a long time. Let's also say that I've changed my mind and don't want to wait until this procedure ends. I'd like to have a "Stop" button on my GUI that would accomplish this. Is that possible? I already have a button that quits...
I'm not sure where I got this, maybe I downloaded it or maybe someone gave me a copy but this is what I'm using: SSHSecureShellClient-3.2.9 on Windows.
The Linux box has: OpenSSH_5.1p1 Debian-5, OpenSSL 0.9.8m.
Expect 5.43.2
Tcl 8.5
# stty -a
speed 38400 baud; rows 25; columns 80; line = 0...
Sending machine is:
Host Name: WDMV-QA-TEST-PC
OS Name: Microsoft Windows 7 Professional
OS Version: 6.1.7601 Service Pack 1 Build 7601
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
OS Build...
Ok, I'd like to try that but isn't it going to prompt me for password every time I send an ssh command? I know what you're going to say, set up passwordless authentication with keys. That would be good for one time but I may have to test many machines at work and don't want to have to go thru...
Hmm... Interesting. But why do all the examples I find talk about spawning ssh? And why no exit at the end? Does the connection just end after the last brace? Are you saying don't use Expect at all? Then how do I get output back? So confusing.
I still don't follow. This is what I'm doing in a nutshell:
spawn ssh2.exe yourLinuxBox
proc1
proc2
proc3
.
.
.
#Then when you're done close the session.
exp_send "exit\r"
exp_close
exp_wait
Are you saying I should instead do:
ssh yourLinuxBox proc1
ssh yourLinuxBox proc2
ssh...
What really pisses me off is that Expect is hacking my code and inserting characters without telling me. I spent a lot of time looking thru my code trying to find my bug why my program wasn't working and it wasn't my code at all. It was Expect inserting questions marks. Now I can't write a...
Because I have to do a lot more things. Don't you open a connection to ssh, do a bunch of things then close the connection? Or do I prepend "ssh2" before every command I send?
It's a bigger program than just one command.
What do you mean? I am. I spawn ssh then send these commands. This is just a snippet not the whole program. Yes I can ssh to it and look manually but I'm trying to automate it.
My code snippet:
set send_slow {2 0.5}
set shell_commands {
"for FILE in *.*\r"
"do\r"
"if \[\[ \$FILE =~ ^\[A-Z0-9]{32}\[.]\[A-Z0-9]{8}\[.]jpg$ ]]; then\r"
":\r"
"else\r"
"echo \"Fail: \$FILE\"\r"
"fi\r"
"done\r"
}
#Send the commands, need to use "-s" to slow it down so...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.