sh 检查并列出给定tar文件的顶部文件夹

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 检查并列出给定tar文件的顶部文件夹相关的知识,希望对你有一定的参考价值。

#!/bin/sh

# check and list the top folders of a give tar file
# Or simply use archivemount 
#    https://linuxaria.com/howto/how-to-mounts-an-archive-for-access-as-a-file-system

# tar_archive_path as /path/to/archive.tar.gz
tar_archive_path=$1

mkdir -p /tmp/tartest 
rm -r /tmp/tartest/* 
tar -zxvf $tar_archive_path -C /tmp/tartest 
ls -a /tmp/tartest

以上是关于sh 检查并列出给定tar文件的顶部文件夹的主要内容,如果未能解决你的问题,请参考以下文章