Wednesday 15 February 2012

tcl - Expect script if command won't run -


Can anyone help me with the following? I think it may be due to the brain, but for the sake of my life, I can not understand it.

This is a simple script, which is going to transfer files based on that location. I'm hoping because I want to handle it through my SAS (SSH), rather than carrying it and moving it between shares to handle it instead of handling it.

  #! To set the downloaded file set to / usr / bin / FileDir set the file name [Lindex $ argv 0] [Lindex $ argv 0] expecting the # script -f set [Lindex $ argv 1] Set MiscDir "/ Media / Miscellaneous / Download" DownDir "/ Media / download "if {[compare string $ $ $ $$ downdair] = 0} {} otherwise {[string $$$$$ compare MiscDir} = 0} {spawning SSH ***** @ * **************************************************************************************************** ********** ******* \ r "" $ "send" mv ~ / Misc / Downloads / $ FileNAME ' Expected "eof" than "$" "exit \ r" for " 

Updated Od:

  #! / Usr / bin / expect -f FileDir the script for # to set the downloaded file went [Lindeks $ argv 0] set filename [Lindeks $ argv 1] set MiscDir "/ media / Miscellaneous / download" set Daundayr "/ media / Download "if {{String $ FileDir compares $ DownDir $} == 0} {} elseif {[string $ FileDir $ MiscDir] == 0} {Set default file" \ "/ share / Miscellaneous / download / $ filename Set movie file "\" / share / diverse / convert / $ file name \ "" egg ssh admin @ appledore "assword: $ $" send "out Exit \ r "EOF Expect" "Send" mv $ OrigFile $ MoveFile "Expect" "Send" XXXXXXXX \ r "Expected"}  

Debug output

  spawn ssh admin @ Aplador parent: syncing awaiting byte parent: child saying to proceed now made Ansinkranaijh baby eggs: hope returns {5222}: "" (Spawn_id exp6) Match Globe pattern "assword:" does it? Admin @ Sepeller's password: Hopefully: "Admin @ Sepeller's password:" (spawn_id exp6) does match globe pattern "assignment:"? Expected: set_out (0, string) set "assword:" expect: set expect_out (spawn_id) "exp6" is expected: set_out (buffer) set "admin @ appledore's password:" send: send " *******! \ R "Expect from {exp6}:" "(spawn_id exp6)" matches the globe pattern "$"? There is no hope: "\ r \ n" (spawn_id exp6) Match Globe pattern does "$"? No [Admin @ Appledore ~] $ expects: "\ r \ n [Admin @ Appledore ~] $" (spawn_id exp6) Match Globe pattern "$"? Hopefully: set expect_out (0, string) Expected "$": set expect_out (spawn_id) Expected "exp6": set expect_out (b F) The "\ r \ n [Admin @ Appledore ~] $" message: send "mv" / shares / Miscellaneous / Downloads / NOOBS_lite_vl_4kzip "" / shares / Miscellaneous / / NOOBS_lite_vl_4kzip to convert "" { exp6} hope: that "(spawn_id exp6) match Globe pattern" $ ""? a & LT; ownloads / NOOBS_lite_v1_4.zip "" / share / misc / convert / NOOBS_lite_vl_4kzip "expect the" mv "/shares/Misc/Downloads/NOOBS_lite_v1_4.zip" "/ Shares / Miscellaneous / Convert / NOOBS_lite_v1_4. Zip \ r & lt; ownloads / NOOBS_lite_v1_4.zip "" / share / misc / convert / NOOBS_lite_v1_4.zip "\ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 \ u0008 "(spawn_id x 6 ) Match Globe Pattern "$"? No  

change your = to ==

= usually For assignment (and does not work in TCL as commented below)

== Test for equality


No comments:

Post a Comment