【发布时间】:2022-01-13 23:31:44
【问题描述】:
我正在尝试查找应用程序类型,以便使用 File 命令确定文件是否为“压缩”文件。 压缩文件具有 .Z 文件类型,我想使用 ' case ... in ' 方法来捕获它。 捕获 gunzip 文件的示例如下:
case $(file --mime-type -b "$myFile") in
application/gzip)
echo "gunzip $myFile" ;;
我试过这样做:
application/ncompress)
echo "uncompress $myFile" ;; # NOT WORKING
但它不起作用。
【问题讨论】:
-
file "$myfile"对此有何评论?
标签: linux bash shell zip compression