<分区>
我有一个脚本可以检查一个文件是否存在于 tar 文件中,但有些地方出了问题,因为它总是转到脚本的“其他”部分。我很确定不应该那样。
日期采用“Mon dd”格式(1 月 11 日)。
echo "enter date: \c"
read date
tarfile=`tar -tvf tarfile.tar | grep some_file | grep "$date"`
if [ -f "$tarfile" ]; then
echo "yes"
else
echo "no"
fi
谢谢。