Sample Header Ad - 728x90

Log the output of Expect command

5 votes
2 answers
7240 views
I have made the below expect script and I need to log the output of that script. SOURCE_FILE=ls -l *.txt --time-style=+%D | grep ${DT} | grep -v '^d' | awk '{print $NF}' if [ -n "${SOURCE_FILE}" ] then cp -p ${SOURCE_FILE} ${T_FILES} /usr/bin/expect" send "put /opt/AppServer/ES_TEST/todays_report/*.txt\r" expect "sftp>" send "bye\r" expect EOD EOD else echo "No Files to copy" >> ${LOGFILE} fi I need to log the output of expect command in ${LOGFILE}. How can It be done? I have tried adding the below things, it doesn't work. What could be done? /usr/bin/expect> ${LOGFILE} 2>&1 set timeout 60 spawn sftp $ES_SFTP_USER@$ES_SFTP_HOST_NAME:$R_LOCATION expect "*?assword:" send "$password\r" expect "sftp>" send "put /opt/AppServer/ES_TEST/todays_report/*.txt\r" expect "sftp>" send "bye\r" expect EOD EOD
Asked by sabarish jackson (628 rep)
Jul 11, 2016, 05:59 AM
Last activity: Jul 12, 2025, 05:07 AM