Posted to tcl by funa at Sun Dec 10 16:56:46 GMT 2017view raw

  1. #!/bin/bash
  2. read -s PWD
  3. /usr/bin/expect - <<EOF
  4. spawn ssh funabashi@localhost
  5. expect "password"
  6. send -- "$PWDr"
  7. send -- "r"
  8. expect "$ "
  9. send "ps -ef r" >> test.txt
  10. expect "$ "
  11. interact
  12. EOF