【发布时间】:2017-06-21 12:37:00
【问题描述】:
我想使用纯期望脚本而不调用外部 shell 来执行 tar 和 rm 操作。我目前的结果是有效的,但使用外部 bash 脚本。
附:我从期望脚本执行 tar 或 rm 的所有尝试都失败了。
主脚本
#!/usr/bin/expect
# my scripts folder is here:
set myhome /home/scripts
set fullBpath /home/backup/SDH/
set date [exec date +%F_%k-%M]
# Some expect script commands was removed here.
exec $myhome/zip_clean.sh $fullBpath $date
send_user "Script terminated.\n"
exit
zip_clean.sh
#!/bin/bash
cd $1
tar cvzf OME6500-Backup-$2 *.cmp *.inf
rm *.cmp *.inf
【问题讨论】: