how to send the output of send command to a file
Hi
in the middle of script, i need to send the output of (send command on line 8) to a file #!/usr/bin/expect spawn telnet 172.20.64.133 expect "ENTER USERNAM <" send "user\r" expect "ENTER PASSWORD <" send "password\r\r" expect "<" send "show command; \r" expect "<" expect eof i treid the below on line 8 : 1- send "show command; \r" > logfile.txt : gives an error extra character after the " 2- logsave logfile.txt 'send "show command; \r" ': error invalid command 3- i simply tried to send the output of the whole script to file logsave /home/logfile ./script : seems that logsave work under root only 4- ./script > logfile : the problem with this is that the output of echo or (read "enter your id") command will not be displayed on the screen (actually nothing will be displayed, i have to open the log file to see the output). is there any way to save the log of the "send" ? or to save the log of the complete script without hiding the output on the screen? |
Code:
/bin/bash script.sh -x > log.out |
hi
still not working, i cannot see any output from any "echo" inside the script on the screen. however, i get the string after (read -p "enter you id")even without the -x :) |
All times are GMT -5. The time now is 01:49 PM. |