fi
fi
+save_err=1
if [[ $archive_file =~ .*\.tar$ \
|| $archive_file =~ .*\.tar\.gz$ \
|| $archive_file =~ .*\.tar\.bz2$ \
|| $archive_file =~ .*\.snarf$ \
]]; then
tar -tf $archive_file | $PAGER
+ save_err=${PIPESTATUS[0]}
elif [[ $archive_file =~ .*\.zip$ \
|| $archive_file =~ .*\.epub$ \
|| $archive_file =~ .*\.odt$ \
|| $archive_file =~ .*\.war$ \
]]; then
unzip -v $archive_file | $PAGER
+ save_err=${PIPESTATUS[0]}
+elif [[ "$archive_file" =~ .*\.7z$ ]]; then
+ 7z l "$archive_file" | $PAGER
+ save_err=${PIPESTATUS[0]}
+elif [[ "$archive_file" =~ .*\.rar$ ]]; then
+ rar l "$archive_file" | $PAGER
+ save_err=${PIPESTATUS[0]}
fi
+
+if [ $save_err -ne 0 ]; then
+ echo "There was a failure reported while listing: $archive_file"
+ exit 1
+fi
+
fi
fi
+save_err=1
if [[ $archive_file =~ .*\.tar$ \
|| $archive_file =~ .*\.tar\.gz$ \
|| $archive_file =~ .*\.tar\.bz2$ \
|| $archive_file =~ .*\.snarf$ \
]]; then
tar -tf $archive_file &>/dev/null
+ save_err=$?
elif [[ $archive_file =~ .*\.zip$ \
|| $archive_file =~ .*\.epub$ \
|| $archive_file =~ .*\.odt$ \
|| $archive_file =~ .*\.war$ \
]]; then
unzip -t $archive_file &>/dev/null
-else
- # we don't know this as an archive.
- exit 0
+ save_err=$?
+elif [[ "$archive_file" =~ .*\.7z$ ]]; then
+ 7z t "$archive_file" &>/dev/null
+ save_err=$?
+elif [[ "$archive_file" =~ .*\.rar$ ]]; then
+ rar t "$archive_file" &>/dev/null
+ save_err=$?
fi
-if [ $? -ne 0 ]; then
+if [ $save_err -ne 0 ]; then
echo "** failure while testing: $archive_file"
exit 1
else