Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2017
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. invalid command name "
  2. while executing
  3. ""r""
  4. invoked from within
  5. "expect {
  6. -ex "--More--" {send -- " "; exp_continue}
  7. "*>" {send "exit r";"r"}
  8. }"
  9. (file "./scriptprueba4.sh" line 12)
  10.  
  11. #!/usr/bin/expect -f
  12. #!/bin/sh
  13. set DATE [exec date +%F]
  14. spawn telnet 111.111.1.111
  15. expect "Username:"
  16. send "userr"
  17. expect "Password: "
  18. send "this.is.the.passr"
  19. expect "*>"
  20. send "show cdp neighbors r"
  21. log_file -noappend CDP.dat
  22. expect { #this is the part i just modified and caused the error.
  23. "More--" {send " "; exp_continue}
  24. ">" {send "exit r"; "r"}
  25. }
  26. expect "$ " #I want this part of the code to be executed after "$" but the script stops before doing it
  27. send "tail -n+6 CDP.dat > CDP2.datr"
  28. expect "$ "
  29. send "./primeros3.sh r"
  30. expect "$ "
  31. send -- "tr -d '\r' < CDPyPuerto.dat | awk '{ printf "%s %s", $0, (length($1) > 16) ? OFS : ORS}' > TablaCDP.dat r"
  32. expect "$ "
  33.  
  34. expect {
  35. "More--" {send " "; exp_continue}
  36. ">" {send "exit r"; "r"}
  37. }
  38.  
  39. #!/usr/bin/expect -f
  40. #!/bin/sh
  41. set DATE [exec date +%F]
  42. spawn telnet 148.228.4.199
  43. expect "Username:"
  44. send "primer"
  45. expect "Password: "
  46. send "no.soy.de.redesr"
  47. expect "*>"
  48. send "show cdp neighbors r"
  49. log_file -noappend CDP.dat
  50. expect -ex "--More--" {send -- " "; exp_continue}
  51. expect "*>"
  52. send "exit r"
  53. expect "$ "
  54. send "tail -n+6 CDP.dat > CDP2.datr"
  55. expect "$ "
  56. send "./primeros3.sh r"
  57. expect "$ "
  58. send -- "tr -d '\r' < CDPyPuerto.dat | awk '{ printf "%s %s", $0, (length($1) > 16) ? OFS : ORS}' > TablaCDP.dat r"
  59. expect "$ "
  60.  
  61. send: spawn id exp4 not open
  62. while executing
  63. "send "tail -n+6 CDP.dat > CDP2.datr""
  64. (file "./scriptprueba4.sh" line 16)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement