我想使用純期望腳本而不調用外部shell來執行tar和rm操作。我目前的結果正在工作,但與外部bash腳本。Expect腳本:如何從中存檔和刪除文件?
P.S.我所有試圖從期望腳本中執行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
看看https://stackoverflow.com/questions/ 44559187/ – pynexj