How to have Expect script output to file
问题 I need to gather some statistics from a network switch and would like to use an expect script to output the data to a file. I would like to run this script as a cron job and have the data appended to the file when it is run. Following is the working code I have so far, I just do not know how to get the output to a file. Any help is greatly appreciated. #!/bin/bash #get mac-address count /usr/bin/expect -f -<<EOD spawn ssh user@192.168.1.100 sleep 2 #Catch the password prompt and send supplied